From dc1425352325bf8a56f5d8ecd1258671808bcadd Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 22 Mar 2017 13:26:57 -0400 Subject: [PATCH] score: switch to RAW_COPY_USER ... and kill copy_in_user() - it's not a biarch architecture, to start with Signed-off-by: Al Viro --- arch/score/Kconfig | 1 + arch/score/include/asm/uaccess.h | 54 ++++---------------------------- 2 files changed, 7 insertions(+), 48 deletions(-) diff --git a/arch/score/Kconfig b/arch/score/Kconfig index 507d63181389..4d241cfedc3b 100644 --- a/arch/score/Kconfig +++ b/arch/score/Kconfig @@ -15,6 +15,7 @@ config SCORE select MODULES_USE_ELF_REL select CLONE_BACKWARDS select CPU_NO_EFFICIENT_FFS + select ARCH_HAS_RAW_COPY_USER choice prompt "System type" diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h index 79125fa6ed43..916e5dbf0bfd 100644 --- a/arch/score/include/asm/uaccess.h +++ b/arch/score/include/asm/uaccess.h @@ -295,61 +295,19 @@ extern void __put_user_unknown(void); extern int __copy_tofrom_user(void *to, const void *from, unsigned long len); static inline unsigned long -copy_from_user(void *to, const void *from, unsigned long len) +raw_copy_from_user(void *to, const void __user *from, unsigned long len) { - unsigned long res = len; - - if (likely(access_ok(VERIFY_READ, from, len))) - res = __copy_tofrom_user(to, from, len); - - if (unlikely(res)) - memset(to + (len - res), 0, res); - - return res; + return __copy_tofrom_user(to, (__force const void *)from, len); } static inline unsigned long -copy_to_user(void *to, const void *from, unsigned long len) +raw_copy_to_user(void __user *to, const void *from, unsigned long len) { - if (likely(access_ok(VERIFY_WRITE, to, len))) - len = __copy_tofrom_user(to, from, len); - - return len; + return __copy_tofrom_user((__force void *)to, from, len); } -static inline unsigned long -__copy_from_user(void *to, const void *from, unsigned long len) -{ - unsigned long left = __copy_tofrom_user(to, from, len); - if (unlikely(left)) - memset(to + (len - left), 0, left); - return left; -} - -#define __copy_to_user(to, from, len) \ - __copy_tofrom_user((to), (from), (len)) - -static inline unsigned long -__copy_to_user_inatomic(void *to, const void *from, unsigned long len) -{ - return __copy_to_user(to, from, len); -} - -static inline unsigned long -__copy_from_user_inatomic(void *to, const void *from, unsigned long len) -{ - return __copy_tofrom_user(to, from, len); -} - -#define __copy_in_user(to, from, len) __copy_tofrom_user(to, from, len) - -static inline unsigned long -copy_in_user(void *to, const void *from, unsigned long len) -{ - if (access_ok(VERIFY_READ, from, len) && - access_ok(VERIFY_WRITE, to, len)) - return __copy_tofrom_user(to, from, len); -} +#define INLINE_COPY_FROM_USER +#define INLINE_COPY_TO_USER /* * __clear_user: - Zero a block of memory in user space, with less checking. -- 2.20.1