]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xtensa: Remove arch-specific strncpy() implementation
authorKees Cook <kees@kernel.org>
Mon, 23 Mar 2026 01:18:34 +0000 (01:18 +0000)
committerKees Cook <kees@kernel.org>
Thu, 18 Jun 2026 23:37:13 +0000 (16:37 -0700)
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
Signed-off-by: Kees Cook <kees@kernel.org>
arch/xtensa/include/asm/string.h

index ffce43513fa298f462e9d4aede1b0c3a8731f454..e16cda026df7166d3fa831cfa10685caacdd9125 100644 (file)
@@ -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)
 {