diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-22 13:26:57 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-28 18:23:58 -0400 |
commit | dc1425352325bf8a56f5d8ecd1258671808bcadd (patch) | |
tree | 5e8eee371ff56e95006f615688b4dfab51fb1eb5 | |
parent | 4b4554f6d562c15159b053fad4146ced2201bc4c (diff) | |
download | lwn-dc1425352325bf8a56f5d8ecd1258671808bcadd.tar.gz lwn-dc1425352325bf8a56f5d8ecd1258671808bcadd.zip |
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 <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/score/Kconfig | 1 | ||||
-rw-r--r-- | 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. |