From 701cac61d0250912b89cbc28589969530179099a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 5 Apr 2017 19:15:53 -0400 Subject: CONFIG_ARCH_HAS_RAW_COPY_USER is unconditional now all architectures converted Signed-off-by: Al Viro --- include/asm-generic/uaccess.h | 41 ----------------------------------------- include/linux/uaccess.h | 7 ++----- 2 files changed, 2 insertions(+), 46 deletions(-) (limited to 'include') diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index d65c311eb128..bbe4bb438e39 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h @@ -86,11 +86,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size) static inline int __put_user_fn(size_t size, void __user *ptr, void *x) { -#ifdef CONFIG_ARCH_HAS_RAW_COPY_USER return unlikely(raw_copy_to_user(ptr, x, size)) ? -EFAULT : 0; -#else - return unlikely(__copy_to_user(ptr, x, size)) ? -EFAULT : 0; -#endif } #define __put_user_fn(sz, u, k) __put_user_fn(sz, u, k) @@ -151,11 +147,7 @@ extern int __put_user_bad(void) __attribute__((noreturn)); #ifndef __get_user_fn static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) { -#ifdef CONFIG_ARCH_HAS_RAW_COPY_USER return unlikely(raw_copy_from_user(x, ptr, size)) ? -EFAULT : 0; -#else - return unlikely(__copy_from_user(x, ptr, size)) ? -EFAULT : 0; -#endif } #define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k) @@ -164,39 +156,6 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) extern int __get_user_bad(void) __attribute__((noreturn)); -#ifndef CONFIG_ARCH_HAS_RAW_COPY_USER - -#ifndef __copy_from_user_inatomic -#define __copy_from_user_inatomic __copy_from_user -#endif - -#ifndef __copy_to_user_inatomic -#define __copy_to_user_inatomic __copy_to_user -#endif - -static inline long copy_from_user(void *to, - const void __user * from, unsigned long n) -{ - unsigned long res = n; - might_fault(); - if (likely(access_ok(VERIFY_READ, from, n))) - res = __copy_from_user(to, from, n); - if (unlikely(res)) - memset(to + (n - res), 0, res); - return res; -} - -static inline long copy_to_user(void __user *to, - const void *from, unsigned long n) -{ - might_fault(); - if (access_ok(VERIFY_WRITE, to, n)) - return __copy_to_user(to, from, n); - else - return n; -} -#endif - /* * Copy a null terminated string from userspace. */ diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 7fc2104b88bc..e0cbfb09e60f 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -12,12 +12,10 @@ #include -#ifdef CONFIG_ARCH_HAS_RAW_COPY_USER /* * Architectures should provide two primitives (raw_copy_{to,from}_user()) - * select ARCH_HAS_RAW_COPY_FROM_USER and get rid of their private instances - * of copy_{to,from}_user() and __copy_{to,from}_user{,_inatomic}(). Once - * all of them switch, this part of linux/uaccess.h will become unconditional. + * and get rid of their private instances of copy_{to,from}_user() and + * __copy_{to,from}_user{,_inatomic}(). * * raw_copy_{to,from}_user(to, from, size) should copy up to size bytes and * return the amount left to copy. They should assume that access_ok() has @@ -196,7 +194,6 @@ copy_in_user(void __user *to, const void *from, unsigned long n) return n; } #endif -#endif static __always_inline void pagefault_disabled_inc(void) { -- cgit v1.2.3