diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-21 08:46:17 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-28 18:23:32 -0400 |
commit | 48f666c986671ea2021971bfbe4d74a7ebcf0a44 (patch) | |
tree | 87111adc44eecad1611535df0609a6e766ea5049 /arch/frv | |
parent | 9a7513cfa26f5fcce15de6130ce3c27d77c0ce55 (diff) |
frv: switch to RAW_COPY_USER
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/frv')
-rw-r--r-- | arch/frv/Kconfig | 1 | ||||
-rw-r--r-- | arch/frv/include/asm/uaccess.h | 57 |
2 files changed, 24 insertions, 34 deletions
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index eefd9a4ed156..e489fef111dd 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -16,6 +16,7 @@ config FRV | |||
16 | select OLD_SIGACTION | 16 | select OLD_SIGACTION |
17 | select HAVE_DEBUG_STACKOVERFLOW | 17 | select HAVE_DEBUG_STACKOVERFLOW |
18 | select ARCH_NO_COHERENT_DMA_MMAP | 18 | select ARCH_NO_COHERENT_DMA_MMAP |
19 | select ARCH_HAS_RAW_COPY_USER | ||
19 | 20 | ||
20 | config ZONE_DMA | 21 | config ZONE_DMA |
21 | bool | 22 | bool |
diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h index 5bcc57de3c95..e4e33b4cd3ae 100644 --- a/arch/frv/include/asm/uaccess.h +++ b/arch/frv/include/asm/uaccess.h | |||
@@ -233,61 +233,50 @@ do { \ | |||
233 | /* | 233 | /* |
234 | * | 234 | * |
235 | */ | 235 | */ |
236 | |||
236 | #define ____force(x) (__force void *)(void __user *)(x) | 237 | #define ____force(x) (__force void *)(void __user *)(x) |
237 | #ifdef CONFIG_MMU | 238 | #ifdef CONFIG_MMU |
238 | extern long __memset_user(void *dst, unsigned long count); | 239 | extern long __memset_user(void *dst, unsigned long count); |
239 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); | 240 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); |
240 | 241 | ||
241 | #define __clear_user(dst,count) __memset_user(____force(dst), (count)) | 242 | #define __clear_user(dst,count) __memset_user(____force(dst), (count)) |
242 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) | ||
243 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) | ||
244 | 243 | ||
245 | #else | 244 | #else |
246 | 245 | ||
247 | #define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) | 246 | #define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) |
248 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) | ||
249 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) | ||
250 | 247 | ||
251 | #endif | 248 | #endif |
252 | 249 | ||
253 | static inline unsigned long __must_check | ||
254 | clear_user(void __user *to, unsigned long n) | ||
255 | { | ||
256 | if (likely(__access_ok(to, n))) | ||
257 | n = __clear_user(to, n); | ||
258 | return n; | ||
259 | } | ||
260 | |||
261 | static inline unsigned long __must_check | ||
262 | __copy_to_user(void __user *to, const void *from, unsigned long n) | ||
263 | { | ||
264 | might_fault(); | ||
265 | return __copy_to_user_inatomic(to, from, n); | ||
266 | } | ||
267 | |||
268 | static inline unsigned long | 250 | static inline unsigned long |
269 | __copy_from_user(void *to, const void __user *from, unsigned long n) | 251 | raw_copy_from_user(void *to, const void __user *from, unsigned long n) |
270 | { | 252 | { |
271 | might_fault(); | 253 | #ifdef CONFIG_MMU |
272 | return __copy_from_user_inatomic(to, from, n); | 254 | return __memcpy_user(to, (__force const void *)from, n); |
255 | #else | ||
256 | memcpy(to, (__force const void *)from, n); | ||
257 | return 0; | ||
258 | #endif | ||
273 | } | 259 | } |
274 | 260 | ||
275 | static inline long copy_from_user(void *to, const void __user *from, unsigned long n) | 261 | static inline unsigned long |
262 | raw_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
276 | { | 263 | { |
277 | unsigned long ret = n; | 264 | #ifdef CONFIG_MMU |
278 | 265 | return __memcpy_user((__force void *)to, from, n); | |
279 | if (likely(__access_ok(from, n))) | 266 | #else |
280 | ret = __copy_from_user(to, from, n); | 267 | memcpy((__force void *)to, from, n); |
281 | 268 | return 0; | |
282 | if (unlikely(ret != 0)) | 269 | #endif |
283 | memset(to + (n - ret), 0, ret); | ||
284 | |||
285 | return ret; | ||
286 | } | 270 | } |
271 | #define INLINE_COPY_TO_USER | ||
272 | #define INLINE_COPY_FROM_USER | ||
287 | 273 | ||
288 | static inline long copy_to_user(void __user *to, const void *from, unsigned long n) | 274 | static inline unsigned long __must_check |
275 | clear_user(void __user *to, unsigned long n) | ||
289 | { | 276 | { |
290 | return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n; | 277 | if (likely(__access_ok(to, n))) |
278 | n = __clear_user(to, n); | ||
279 | return n; | ||
291 | } | 280 | } |
292 | 281 | ||
293 | extern long strncpy_from_user(char *dst, const char __user *src, long count); | 282 | extern long strncpy_from_user(char *dst, const char __user *src, long count); |