[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260102-armeb-memset64-v1-1-9aa15fb8e820@linutronix.de>
Date: Fri, 02 Jan 2026 08:15:46 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Russell King <linux@...linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>
Cc: Russell King <rmk+kernel@...linux.org.uk>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>, stable@...r.kernel.org,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Subject: [PATCH] ARM: fix memset64() on big-endian
On big-endian systems the 32-bit low and high halves need to be swapped,
for the underlying assembly implemenation to work correctly.
Fixes: fd1d362600e2 ("ARM: implement memset32 & memset64")
Cc: stable@...r.kernel.org
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
---
Found by the string_test_memset64 KUnit test.
---
arch/arm/include/asm/string.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h
index 6c607c68f3ad..c35250c4991b 100644
--- a/arch/arm/include/asm/string.h
+++ b/arch/arm/include/asm/string.h
@@ -42,7 +42,10 @@ static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n)
extern void *__memset64(uint64_t *, uint32_t low, __kernel_size_t, uint32_t hi);
static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n)
{
- return __memset64(p, v, n * 8, v >> 32);
+ if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN))
+ return __memset64(p, v, n * 8, v >> 32);
+ else
+ return __memset64(p, v >> 32, n * 8, v);
}
/*
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251230-armeb-memset64-01f2ae83f9ef
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Powered by blists - more mailing lists