diff options
Diffstat (limited to 'arch/microblaze/include/asm/uaccess.h')
-rw-r--r-- | arch/microblaze/include/asm/uaccess.h | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 34b79feb1ff1..b33ab659781e 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -111,6 +111,9 @@ static inline int ___range_ok(unsigned long addr, unsigned long size) | |||
111 | # define __EX_TABLE_SECTION ".section .discard,\"a\"\n" | 111 | # define __EX_TABLE_SECTION ".section .discard,\"a\"\n" |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | extern unsigned long __copy_tofrom_user(void __user *to, | ||
115 | const void __user *from, unsigned long size); | ||
116 | |||
114 | /* Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail. */ | 117 | /* Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail. */ |
115 | static inline unsigned long __must_check __clear_user(void __user *to, | 118 | static inline unsigned long __must_check __clear_user(void __user *to, |
116 | unsigned long n) | 119 | unsigned long n) |
@@ -322,23 +325,6 @@ static inline long strncpy_from_user(char *dst, | |||
322 | return res; | 325 | return res; |
323 | } | 326 | } |
324 | 327 | ||
325 | static inline unsigned long __copy_tofrom_user(void __user *to, | ||
326 | const void __user *from, unsigned long size) | ||
327 | { | ||
328 | memcpy(to, from, size); | ||
329 | return 0; | ||
330 | } | ||
331 | |||
332 | #define copy_to_user(to, from, n) (memcpy((to), (from), (n)), 0) | ||
333 | #define copy_from_user(to, from, n) (memcpy((to), (from), (n)), 0) | ||
334 | |||
335 | #define __copy_to_user(to, from, n) (copy_to_user((to), (from), (n))) | ||
336 | #define __copy_from_user(to, from, n) (copy_from_user((to), (from), (n))) | ||
337 | #define __copy_to_user_inatomic(to, from, n) \ | ||
338 | (__copy_to_user((to), (from), (n))) | ||
339 | #define __copy_from_user_inatomic(to, from, n) \ | ||
340 | (__copy_from_user((to), (from), (n))) | ||
341 | |||
342 | extern long strncpy_from_user(char *dst, const char *src, long count); | 328 | extern long strncpy_from_user(char *dst, const char *src, long count); |
343 | extern long strnlen_user(const char *src, long count); | 329 | extern long strnlen_user(const char *src, long count); |
344 | 330 | ||
@@ -350,8 +336,24 @@ extern long strnlen_user(const char *src, long count); | |||
350 | ? __put_user((x), (ptr)) : -EFAULT; \ | 336 | ? __put_user((x), (ptr)) : -EFAULT; \ |
351 | }) | 337 | }) |
352 | 338 | ||
353 | extern unsigned long __copy_tofrom_user(void __user *to, | 339 | extern int __strncpy_user(char *to, const char __user *from, int len); |
354 | const void __user *from, unsigned long size); | 340 | |
341 | #define __strncpy_from_user __strncpy_user | ||
342 | |||
343 | static inline long | ||
344 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
345 | { | ||
346 | if (!access_ok(VERIFY_READ, src, 1)) | ||
347 | return -EFAULT; | ||
348 | return __strncpy_from_user(dst, src, count); | ||
349 | } | ||
350 | |||
351 | extern int __strnlen_user(const char __user *sstr, int len); | ||
352 | |||
353 | #define strnlen_user(str, len) \ | ||
354 | (access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0) | ||
355 | |||
356 | #endif /* CONFIG_MMU */ | ||
355 | 357 | ||
356 | #define __copy_from_user(to, from, n) \ | 358 | #define __copy_from_user(to, from, n) \ |
357 | __copy_tofrom_user((__force void __user *)(to), \ | 359 | __copy_tofrom_user((__force void __user *)(to), \ |
@@ -384,25 +386,6 @@ static inline long copy_to_user(void __user *to, | |||
384 | return n; | 386 | return n; |
385 | } | 387 | } |
386 | 388 | ||
387 | extern int __strncpy_user(char *to, const char __user *from, int len); | ||
388 | |||
389 | #define __strncpy_from_user __strncpy_user | ||
390 | |||
391 | static inline long | ||
392 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
393 | { | ||
394 | if (!access_ok(VERIFY_READ, src, 1)) | ||
395 | return -EFAULT; | ||
396 | return __strncpy_from_user(dst, src, count); | ||
397 | } | ||
398 | |||
399 | extern int __strnlen_user(const char __user *sstr, int len); | ||
400 | |||
401 | #define strnlen_user(str, len) \ | ||
402 | (access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0) | ||
403 | |||
404 | #endif /* CONFIG_MMU */ | ||
405 | |||
406 | #endif /* __ASSEMBLY__ */ | 389 | #endif /* __ASSEMBLY__ */ |
407 | #endif /* __KERNEL__ */ | 390 | #endif /* __KERNEL__ */ |
408 | 391 | ||