From 2f69b04a88687626b044a66661c570ca0ca6a0fc Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 14 May 2021 23:57:16 +0200 Subject: h8300: remove stale strncpy_from_user This function is never called because h8300 uses the asm-generic inline function version. Reviewed-by: Christoph Hellwig Signed-off-by: Arnd Bergmann --- arch/h8300/kernel/h8300_ksyms.c | 2 -- arch/h8300/lib/Makefile | 2 +- arch/h8300/lib/strncpy.S | 35 ----------------------------------- 3 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 arch/h8300/lib/strncpy.S (limited to 'arch/h8300') diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c index 1c6f902e82a5..853d6e886477 100644 --- a/arch/h8300/kernel/h8300_ksyms.c +++ b/arch/h8300/kernel/h8300_ksyms.c @@ -19,7 +19,6 @@ asmlinkage long __mulsi3(long, long); asmlinkage long __udivsi3(long, long); asmlinkage void *memcpy(void *, const void *, size_t); asmlinkage void *memset(void *, int, size_t); -asmlinkage long strncpy_from_user(void *to, void *from, size_t n); /* gcc lib functions */ EXPORT_SYMBOL(__ucmpdi2); @@ -34,4 +33,3 @@ EXPORT_SYMBOL(__mulsi3); EXPORT_SYMBOL(__udivsi3); EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memset); -EXPORT_SYMBOL(strncpy_from_user); diff --git a/arch/h8300/lib/Makefile b/arch/h8300/lib/Makefile index 685fa837c1f7..5911c1fa856d 100644 --- a/arch/h8300/lib/Makefile +++ b/arch/h8300/lib/Makefile @@ -3,7 +3,7 @@ # Makefile for H8/300-specific library files.. # -lib-y = memcpy.o memset.o abs.o strncpy.o \ +lib-y = memcpy.o memset.o abs.o \ mulsi3.o udivsi3.o muldi3.o moddivsi3.o \ ashldi3.o lshrdi3.o ashrdi3.o ucmpdi2.o \ delay.o diff --git a/arch/h8300/lib/strncpy.S b/arch/h8300/lib/strncpy.S deleted file mode 100644 index 8b65d7c4727b..000000000000 --- a/arch/h8300/lib/strncpy.S +++ /dev/null @@ -1,35 +0,0 @@ -;;; SPDX-License-Identifier: GPL-2.0 -;;; strncpy.S - -#include - - .text -.global strncpy_from_user - -;;; long strncpy_from_user(void *to, void *from, size_t n) -strncpy_from_user: - mov.l er2,er2 - bne 1f - sub.l er0,er0 - rts -1: - mov.l er4,@-sp - sub.l er3,er3 -2: - mov.b @er1+,r4l - mov.b r4l,@er0 - adds #1,er0 - beq 3f - inc.l #1,er3 - dec.l #1,er2 - bne 2b -3: - dec.l #1,er2 -4: - mov.b r4l,@er0 - adds #1,er0 - dec.l #1,er2 - bne 4b - mov.l er3,er0 - mov.l @sp+,er4 - rts -- cgit v1.2.3 From 98b861a304318e60eea584bef123d924e5d0dcff Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sat, 23 Jan 2021 15:21:22 +0100 Subject: asm-generic: uaccess: remove inline strncpy_from_user/strnlen_user The inline version is used on three NOMMU architectures and is particularly inefficient when it scans the string one byte at a time twice. It also lacks a check for user_addr_max(), but this is probably ok on NOMMU targets. Consolidate the asm-generic implementation with the library version that is used everywhere else. This version is generalized enough to work efficiently on both MMU and NOMMU targets, and using the same code everywhere reduces the potential for subtle bugs. Mark the prototypes as __must_check in the process. Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven Reviewed-by: Christoph Hellwig Signed-off-by: Arnd Bergmann --- arch/h8300/Kconfig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/h8300') diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 3e3e0f16f7e0..53dfd2d47e0e 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -11,6 +11,8 @@ config H8300 select GENERIC_IRQ_SHOW select FRAME_POINTER select GENERIC_CPU_DEVICES + select GENERIC_STRNCPY_FROM_USER + select GENERIC_STRNLEN_USER select MODULES_USE_ELF_RELA select COMMON_CLK select ARCH_WANT_FRAME_POINTERS -- cgit v1.2.3 From e6226997ec5ac272fa76274c3675bd5b7b437c53 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 17 May 2021 09:22:34 +0200 Subject: asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols Most architectures do not need a custom implementation, and in most cases the generic implementation is preferred, so change the polariy on these Kconfig symbols to require architectures to select them when they provide their own version. The new name is CONFIG_ARCH_HAS_{STRNCPY_FROM,STRNLEN}_USER. The remaining architectures at the moment are: ia64, mips, parisc, um and xtensa. We should probably convert these as well, but I was not sure how far to take this series. Thomas Bogendoerfer had some concerns about converting mips but may still do some more detailed measurements to see which version is better. Cc: "James E.J. Bottomley" Cc: Anton Ivanov Cc: Christian Borntraeger Cc: Heiko Carstens Cc: Helge Deller Cc: Jeff Dike Cc: Max Filippov Cc: Richard Weinberger Cc: Thomas Bogendoerfer Cc: Vasily Gorbik Cc: linux-ia64@vger.kernel.org Cc: linux-mips@vger.kernel.org Cc: linux-parisc@vger.kernel.org Cc: linux-s390@vger.kernel.org Cc: linux-um@lists.infradead.org Cc: linux-xtensa@linux-xtensa.org Acked-by: Geert Uytterhoeven Acked-by: Helge Deller # parisc Reviewed-by: Christoph Hellwig Signed-off-by: Arnd Bergmann --- arch/h8300/Kconfig | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/h8300') diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 53dfd2d47e0e..3e3e0f16f7e0 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -11,8 +11,6 @@ config H8300 select GENERIC_IRQ_SHOW select FRAME_POINTER select GENERIC_CPU_DEVICES - select GENERIC_STRNCPY_FROM_USER - select GENERIC_STRNLEN_USER select MODULES_USE_ELF_RELA select COMMON_CLK select ARCH_WANT_FRAME_POINTERS -- cgit v1.2.3