diff options
| author | Kees Cook <kees@kernel.org> | 2026-03-23 04:17:59 +0300 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-06-19 02:37:13 +0300 |
| commit | dfe05fcca83d794cd76da1b6deb2dcd082aa1174 (patch) | |
| tree | dd5b6f8dd8a4f4b364326717c18a023bbd16c119 | |
| parent | 7eda356658cbfba9aea48bddd12b97e562c21188 (diff) | |
| download | linux-dfe05fcca83d794cd76da1b6deb2dcd082aa1174.tar.xz | |
x86: Remove arch-specific strncpy() implementation
strncpy() has no remaining callers in the kernel[1]. Remove the
x86-32-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>
| -rw-r--r-- | arch/x86/include/asm/string_32.h | 3 | ||||
| -rw-r--r-- | arch/x86/lib/string_32.c | 19 |
2 files changed, 0 insertions, 22 deletions
diff --git a/arch/x86/include/asm/string_32.h b/arch/x86/include/asm/string_32.h index e9cce169bb4c..43ab6806ab53 100644 --- a/arch/x86/include/asm/string_32.h +++ b/arch/x86/include/asm/string_32.h @@ -9,9 +9,6 @@ #define __HAVE_ARCH_STRCPY extern char *strcpy(char *dest, const char *src); -#define __HAVE_ARCH_STRNCPY -extern char *strncpy(char *dest, const char *src, size_t count); - #define __HAVE_ARCH_STRCAT extern char *strcat(char *dest, const char *src); diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c index f87ec24fa579..a9480d73c4f0 100644 --- a/arch/x86/lib/string_32.c +++ b/arch/x86/lib/string_32.c @@ -30,25 +30,6 @@ char *strcpy(char *dest, const char *src) EXPORT_SYMBOL(strcpy); #endif -#ifdef __HAVE_ARCH_STRNCPY -char *strncpy(char *dest, const char *src, size_t count) -{ - int d0, d1, d2, d3; - asm volatile("1:\tdecl %2\n\t" - "js 2f\n\t" - "lodsb\n\t" - "stosb\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "rep stosb\n" - "2:" - : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3) - : "0" (src), "1" (dest), "2" (count) : "memory"); - return dest; -} -EXPORT_SYMBOL(strncpy); -#endif - #ifdef __HAVE_ARCH_STRCAT char *strcat(char *dest, const char *src) { |
