]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
m68k: Remove arch-specific strncpy() implementation
authorKees Cook <kees@kernel.org>
Mon, 23 Mar 2026 01:16:06 +0000 (01:16 +0000)
committerKees Cook <kees@kernel.org>
Thu, 18 Jun 2026 23:37:12 +0000 (16:37 -0700)
strncpy() has no remaining callers in the kernel[1]. Remove the
m68k-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/m68k/include/asm/string.h

index 760cc13acdf41672fbadb9c21665318f4af2b4e0..ae6a6b51ad07146a067f28d9d5bd057182e50b19 100644 (file)
@@ -21,23 +21,6 @@ static inline size_t strnlen(const char *s, size_t count)
        return sc - s;
 }
 
-#define __HAVE_ARCH_STRNCPY
-static inline char *strncpy(char *dest, const char *src, size_t n)
-{
-       char *xdest = dest;
-
-       asm volatile ("\n"
-               "       jra     2f\n"
-               "1:     move.b  (%1),(%0)+\n"
-               "       jeq     2f\n"
-               "       addq.l  #1,%1\n"
-               "2:     subq.l  #1,%2\n"
-               "       jcc     1b\n"
-               : "+a" (dest), "+a" (src), "+d" (n)
-               : : "memory");
-       return xdest;
-}
-
 #define __HAVE_ARCH_MEMMOVE
 extern void *memmove(void *, const void *, __kernel_size_t);