diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-22 13:08:32 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-28 18:23:50 -0400 |
| commit | de51d6cc2cf9daa9b5155faefb714f5b477cf160 (patch) | |
| tree | f7ab7e25a42407a2473a8cd95f0ff7288c83a7b3 | |
| parent | 981db65b5229edb5ab336e3e23758791a1aa0b03 (diff) | |
nios2: switch to RAW_COPY_USER
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | arch/nios2/Kconfig | 1 | ||||
| -rw-r--r-- | arch/nios2/include/asm/uaccess.h | 31 | ||||
| -rw-r--r-- | arch/nios2/mm/uaccess.c | 16 |
3 files changed, 15 insertions, 33 deletions
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 51a56c8b04b4..45b4727e3136 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig | |||
| @@ -16,6 +16,7 @@ config NIOS2 | |||
| 16 | select SPARSE_IRQ | 16 | select SPARSE_IRQ |
| 17 | select USB_ARCH_HAS_HCD if USB_SUPPORT | 17 | select USB_ARCH_HAS_HCD if USB_SUPPORT |
| 18 | select CPU_NO_EFFICIENT_FFS | 18 | select CPU_NO_EFFICIENT_FFS |
| 19 | select ARCH_HAS_RAW_COPY_USER | ||
| 19 | 20 | ||
| 20 | config GENERIC_CSUM | 21 | config GENERIC_CSUM |
| 21 | def_bool y | 22 | def_bool y |
diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h index ed06750a6c92..727bd9504899 100644 --- a/arch/nios2/include/asm/uaccess.h +++ b/arch/nios2/include/asm/uaccess.h | |||
| @@ -73,36 +73,17 @@ static inline unsigned long __must_check clear_user(void __user *to, | |||
| 73 | return __clear_user(to, n); | 73 | return __clear_user(to, n); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | extern long __copy_from_user(void *to, const void __user *from, | 76 | extern unsigned long |
| 77 | unsigned long n); | 77 | raw_copy_from_user(void *to, const void __user *from, unsigned long n); |
| 78 | extern long __copy_to_user(void __user *to, const void *from, unsigned long n); | 78 | extern unsigned long |
| 79 | 79 | raw_copy_to_user(void __user *to, const void *from, unsigned long n); | |
| 80 | static inline long copy_from_user(void *to, const void __user *from, | 80 | #define INLINE_COPY_FROM_USER |
| 81 | unsigned long n) | 81 | #define INLINE_COPY_TO_USER |
| 82 | { | ||
| 83 | unsigned long res = n; | ||
| 84 | if (access_ok(VERIFY_READ, from, n)) | ||
| 85 | res = __copy_from_user(to, from, n); | ||
| 86 | if (unlikely(res)) | ||
| 87 | memset(to + (n - res), 0, res); | ||
| 88 | return res; | ||
| 89 | } | ||
| 90 | |||
| 91 | static inline long copy_to_user(void __user *to, const void *from, | ||
| 92 | unsigned long n) | ||
| 93 | { | ||
| 94 | if (!access_ok(VERIFY_WRITE, to, n)) | ||
| 95 | return n; | ||
| 96 | return __copy_to_user(to, from, n); | ||
| 97 | } | ||
| 98 | 82 | ||
| 99 | extern long strncpy_from_user(char *__to, const char __user *__from, | 83 | extern long strncpy_from_user(char *__to, const char __user *__from, |
| 100 | long __len); | 84 | long __len); |
| 101 | extern long strnlen_user(const char __user *s, long n); | 85 | extern long strnlen_user(const char __user *s, long n); |
| 102 | 86 | ||
| 103 | #define __copy_from_user_inatomic __copy_from_user | ||
| 104 | #define __copy_to_user_inatomic __copy_to_user | ||
| 105 | |||
| 106 | /* Optimized macros */ | 87 | /* Optimized macros */ |
| 107 | #define __get_user_asm(val, insn, addr, err) \ | 88 | #define __get_user_asm(val, insn, addr, err) \ |
| 108 | { \ | 89 | { \ |
diff --git a/arch/nios2/mm/uaccess.c b/arch/nios2/mm/uaccess.c index 7663e156ff4f..804983317766 100644 --- a/arch/nios2/mm/uaccess.c +++ b/arch/nios2/mm/uaccess.c | |||
| @@ -10,9 +10,9 @@ | |||
| 10 | #include <linux/export.h> | 10 | #include <linux/export.h> |
| 11 | #include <linux/uaccess.h> | 11 | #include <linux/uaccess.h> |
| 12 | 12 | ||
| 13 | asm(".global __copy_from_user\n" | 13 | asm(".global raw_copy_from_user\n" |
| 14 | " .type __copy_from_user, @function\n" | 14 | " .type raw_copy_from_user, @function\n" |
| 15 | "__copy_from_user:\n" | 15 | "raw_copy_from_user:\n" |
| 16 | " movi r2,7\n" | 16 | " movi r2,7\n" |
| 17 | " mov r3,r4\n" | 17 | " mov r3,r4\n" |
| 18 | " bge r2,r6,1f\n" | 18 | " bge r2,r6,1f\n" |
| @@ -65,12 +65,12 @@ asm(".global __copy_from_user\n" | |||
| 65 | ".word 7b,13b\n" | 65 | ".word 7b,13b\n" |
| 66 | ".previous\n" | 66 | ".previous\n" |
| 67 | ); | 67 | ); |
| 68 | EXPORT_SYMBOL(__copy_from_user); | 68 | EXPORT_SYMBOL(raw_copy_from_user); |
| 69 | 69 | ||
| 70 | asm( | 70 | asm( |
| 71 | " .global __copy_to_user\n" | 71 | " .global raw_copy_to_user\n" |
| 72 | " .type __copy_to_user, @function\n" | 72 | " .type raw_copy_to_user, @function\n" |
| 73 | "__copy_to_user:\n" | 73 | "raw_copy_to_user:\n" |
| 74 | " movi r2,7\n" | 74 | " movi r2,7\n" |
| 75 | " mov r3,r4\n" | 75 | " mov r3,r4\n" |
| 76 | " bge r2,r6,1f\n" | 76 | " bge r2,r6,1f\n" |
| @@ -127,7 +127,7 @@ asm( | |||
| 127 | ".word 11b,13b\n" | 127 | ".word 11b,13b\n" |
| 128 | ".word 12b,13b\n" | 128 | ".word 12b,13b\n" |
| 129 | ".previous\n"); | 129 | ".previous\n"); |
| 130 | EXPORT_SYMBOL(__copy_to_user); | 130 | EXPORT_SYMBOL(raw_copy_to_user); |
| 131 | 131 | ||
| 132 | long strncpy_from_user(char *__to, const char __user *__from, long __len) | 132 | long strncpy_from_user(char *__to, const char __user *__from, long __len) |
| 133 | { | 133 | { |
