From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet Gupta Subject: [RFC 3/4] ARC: uaccess: remove noinline variants of __strncpy_from_user() and friends Date: Tue, 14 Jan 2020 12:08:45 -0800 Message-ID: <20200114200846.29434-4-vgupta@synopsys.com> References: <20200114200846.29434-1-vgupta@synopsys.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: Received: from sv2-smtprelay2.synopsys.com ([149.117.73.133]:53158 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgANUI5 (ORCPT ); Tue, 14 Jan 2020 15:08:57 -0500 In-Reply-To: <20200114200846.29434-1-vgupta@synopsys.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Arnd Bergmann , Khalid Aziz , Andrey Konovalov , Andrew Morton , Peter Zijlstra , Christian Brauner , Kees Cook , Ingo Molnar , Aleksa Sarai , Linus Torvalds Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta This helps with subsequent removal of arch specific variants in favour of optimized generic routines (word vs byte access) Signed-off-by: Vineet Gupta --- arch/arc/include/asm/uaccess.h | 26 ++++++-------------------- arch/arc/mm/extable.c | 23 ----------------------- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index ea40ec7f6cae..0b34c152086f 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h @@ -613,7 +613,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n) return res; } -static inline unsigned long __arc_clear_user(void __user *to, unsigned long n) +static inline unsigned long __clear_user(void __user *to, unsigned long n) { long res = n; unsigned char *d_char = to; @@ -656,7 +656,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n) } static inline long -__arc_strncpy_from_user(char *dst, const char __user *src, long count) +__strncpy_from_user(char *dst, const char __user *src, long count) { long res = 0; char val; @@ -688,7 +688,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) return res; } -static inline long __arc_strnlen_user(const char __user *s, long n) +static inline long __strnlen_user(const char __user *s, long n) { long res, tmp1, cnt; char val; @@ -718,26 +718,12 @@ static inline long __arc_strnlen_user(const char __user *s, long n) return res; } -#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE - #define INLINE_COPY_TO_USER #define INLINE_COPY_FROM_USER -#define __clear_user(d, n) __arc_clear_user(d, n) -#define __strncpy_from_user(d, s, n) __arc_strncpy_from_user(d, s, n) -#define __strnlen_user(s, n) __arc_strnlen_user(s, n) -#else -extern unsigned long arc_clear_user_noinline(void __user *to, - unsigned long n); -extern long arc_strncpy_from_user_noinline (char *dst, const char __user *src, - long count); -extern long arc_strnlen_user_noinline(const char __user *src, long n); - -#define __clear_user(d, n) arc_clear_user_noinline(d, n) -#define __strncpy_from_user(d, s, n) arc_strncpy_from_user_noinline(d, s, n) -#define __strnlen_user(s, n) arc_strnlen_user_noinline(s, n) - -#endif +#define __clear_user __clear_user +#define __strncpy_from_user __strncpy_from_user +#define __strnlen_user __strnlen_user #include #include diff --git a/arch/arc/mm/extable.c b/arch/arc/mm/extable.c index b06b09ddf924..88fa3a4d4906 100644 --- a/arch/arc/mm/extable.c +++ b/arch/arc/mm/extable.c @@ -22,26 +22,3 @@ int fixup_exception(struct pt_regs *regs) return 0; } - -#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE - -unsigned long arc_clear_user_noinline(void __user *to, - unsigned long n) -{ - return __arc_clear_user(to, n); -} -EXPORT_SYMBOL(arc_clear_user_noinline); - -long arc_strncpy_from_user_noinline(char *dst, const char __user *src, - long count) -{ - return __arc_strncpy_from_user(dst, src, count); -} -EXPORT_SYMBOL(arc_strncpy_from_user_noinline); - -long arc_strnlen_user_noinline(const char __user *src, long n) -{ - return __arc_strnlen_user(src, n); -} -EXPORT_SYMBOL(arc_strnlen_user_noinline); -#endif -- 2.20.1