Commit 58c4ce8cd6cd for kernel

commit 58c4ce8cd6cd1fbf1bca2e1d1f42f9e2899fa934
Author: Kees Cook <kees@kernel.org>
Date:   Mon Mar 23 01:18:34 2026 +0000

    xtensa: Remove arch-specific strncpy() implementation

    strncpy() has no remaining callers in the kernel[1]. Remove the
    xtensa-specific inline assembly implementation and __HAVE_ARCH_STRNCPY
    define, falling back to the generic version in lib/string.c.

    Link: https://github.com/KSPP/linux/issues/90 [1]
    Signed-off-by: Kees Cook <kees@kernel.org>

diff --git a/arch/xtensa/include/asm/string.h b/arch/xtensa/include/asm/string.h
index ffce43513fa2..e16cda026df7 100644
--- a/arch/xtensa/include/asm/string.h
+++ b/arch/xtensa/include/asm/string.h
@@ -34,31 +34,6 @@ static inline char *strcpy(char *__dest, const char *__src)
 	return __xdest;
 }

-#define __HAVE_ARCH_STRNCPY
-static inline char *strncpy(char *__dest, const char *__src, size_t __n)
-{
-	register char *__xdest = __dest;
-	unsigned long __dummy;
-
-	if (__n == 0)
-		return __xdest;
-
-	__asm__ __volatile__(
-		"1:\n\t"
-		"l8ui	%2, %1, 0\n\t"
-		"s8i	%2, %0, 0\n\t"
-		"addi	%1, %1, 1\n\t"
-		"addi	%0, %0, 1\n\t"
-		"beqz	%2, 2f\n\t"
-		"bne	%1, %5, 1b\n"
-		"2:"
-		: "=r" (__dest), "=r" (__src), "=&r" (__dummy)
-		: "0" (__dest), "1" (__src), "r" ((uintptr_t)__src+__n)
-		: "memory");
-
-	return __xdest;
-}
-
 #define __HAVE_ARCH_STRCMP
 static inline int strcmp(const char *__cs, const char *__ct)
 {