From: Hanlin Song <pgeorge8929@gmail.com>
To: guoren@kernel.org
Cc: linux-csky@vger.kernel.org, linux-kernel@vger.kernel.org,
Hanlin Song <pgeorge8929@gmail.com>
Subject: [PATCH] csky: Fix ABIv2 memcmp() s1 alignment check
Date: Tue, 23 Jun 2026 19:24:38 +0800 [thread overview]
Message-ID: <20260623112438.33022-1-pgeorge8929@gmail.com> (raw)
memcmp() saves the original s1 pointer in r3 and then clears r0 for the
return value. The following alignment check tests r0 instead of r3:
mov r3, r0
movi r0, 0
...
andi r13, r0, 3
As a result, the path for an unaligned s1 address is never taken, and
memcmp() may issue word loads from an unaligned s1 address.
Test r3 instead, which still holds the original s1 pointer.
Signed-off-by: Hanlin Song <pgeorge8929@gmail.com>
---
arch/csky/abiv2/memcmp.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/csky/abiv2/memcmp.S b/arch/csky/abiv2/memcmp.S
index bf0d809f0..1c6ced74d 100644
--- a/arch/csky/abiv2/memcmp.S
+++ b/arch/csky/abiv2/memcmp.S
@@ -12,7 +12,7 @@ ENTRY(memcmp)
cmplti r2, 4
bt .L_compare_by_byte
- andi r13, r0, 3
+ andi r13, r3, 3
movi r19, 4
/* Test if s1 is not 4 bytes aligned. */
--
2.25.1
reply other threads:[~2026-06-23 11:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-all 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=20260623112438.33022-1-pgeorge8929@gmail.com \
--to=pgeorge8929@gmail.com \
--cc=guoren@kernel.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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