From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, liming.gao@intel.com
Cc: leif.lindholm@linaro.org, vishalo@qti.qualcomm.com,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2 1/3] MdePkg/BaseMemoryLibOptDxe ARM: fix arithmetic bugs in CompareMem()
Date: Mon, 19 Sep 2016 09:13:49 +0100 [thread overview]
Message-ID: <1474272831-20840-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1474272831-20840-1-git-send-email-ard.biesheuvel@linaro.org>
Fix two bugs:
- Erroneous shift of 2 in a bytes to bits conversion.
- Use reverse subtract rather than negate for value that is subsequently
used as operand #2 in a shift operation.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S
index 951d15777a38..3aadebace30f 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S
@@ -110,9 +110,9 @@ ASM_PFX(InternalMemCompareMem):
bic src1, src1, #3
bic src2, src2, #3
add limit, limit, tmp1 // Adjust the limit for the extra.
- lsl tmp1, tmp1, #2 // Bytes beyond alignment -> bits.
+ lsl tmp1, tmp1, #3 // Bytes beyond alignment -> bits.
ldr data1, [src1], #4
- neg tmp1, tmp1 // Bits to alignment -32.
+ rsb tmp1, tmp1, #32 // Bits to alignment -32.
ldr data2, [src2], #4
mov tmp2, #~0
--
2.7.4
next prev parent reply other threads:[~2016-09-19 8:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 8:13 [PATCH v2 0/3] MdePkg/BaseMemoryLibOptDxe: generic and ARM/AARCH64 fixes Ard Biesheuvel
2016-09-19 8:13 ` Ard Biesheuvel [this message]
2016-09-19 8:13 ` [PATCH v2 2/3] MdePkg/BaseMemoryLib*: add missing ASSERT()s Ard Biesheuvel
2016-09-20 2:00 ` Wu, Hao A
2016-09-20 8:38 ` Ard Biesheuvel
2016-09-20 12:02 ` Wu, Hao A
2016-09-20 12:16 ` Ard Biesheuvel
2016-09-20 12:40 ` Ard Biesheuvel
2016-09-21 1:27 ` Gao, Liming
2016-09-19 8:13 ` [PATCH v2 3/3] MdePkg/BaseMemoryLibOptDxe ARM|AARCH64: implement accelerated GUID functions Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474272831-20840-2-git-send-email-ard.biesheuvel@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox