Re: [PATCH 5.10 02/41] ARM: 9468/1: fix memset64() on big-endian

Ben Hutchings
2026-02-21T20:21:58Z

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

On Mon, 2026-02-09 at 15:24 +0100, Greg Kroah-Hartman wrote:
> 5.10-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Thomas Weissschuh <thomas.weissschuh@linutronix.de>
>
> commit 23ea2a4c72323feb6e3e025e8a6f18336513d5ad upstream.
>
> On big-endian systems the 32-bit low and high halves need to be swapped
> for the underlying assembly implementation to work correctly.

Now it's broken on little-endian, because CONFIG_CPU_LITTLE_ENDIAN was
only introduced in 5.19.

For 5.10 and 5.15, please revert this or change the condition to
!IS_ENABLED(CONFIG_CPU_BIG_ENDIAN).

Ben.

>
> 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>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> arch/arm/include/asm/string.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> --- a/arch/arm/include/asm/string.h
> +++ b/arch/arm/include/asm/string.h
> @@ -36,7 +36,10 @@ static inline void *memset32(uint32_t *p
> 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);
> }
>
> #endif
>
>

--
Ben Hutchings
Who are all these weirdos? - David Bowie, on joining IRC

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]