summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weissschuh <thomas.weissschuh@linutronix.de>2026-01-07 11:01:49 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2026-01-31 12:58:27 +0000
commit23ea2a4c72323feb6e3e025e8a6f18336513d5ad (patch)
tree32771e136611009e3d539fbe129be6c860edae04
parent8f0b4cce4481fb22653697cced8d0d04027cb1e8 (diff)
ARM: 9468/1: fix memset64() on big-endian
On big-endian systems the 32-bit low and high halves need to be swapped for the underlying assembly implementation to work correctly. Fixes: fd1d362600e2 ("ARM: implement memset32 & memset64") Cc: stable@vger.kernel.org Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/include/asm/string.h5
1 files changed, 4 insertions, 1 deletions
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);
}
/*