aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/include/asm/uaccess.h
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2010-03-22 10:56:32 -0400
committerMichal Simek <monstr@monstr.eu>2010-04-01 02:38:21 -0400
commit4270690bd4b1420a8d634ea31953a1c4def2a44a (patch)
treec0418abd19b4e0f9f854c8e05b916d1e0b9c49c8 /arch/microblaze/include/asm/uaccess.h
parentcc5a428b7ae9c2d6233b5bf6b3e6fbb24ddd1ed5 (diff)
microblaze: uaccess: fix copy_from_user macro
copy_from_user macro also use copy_tofrom_user function Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/include/asm/uaccess.h')
-rw-r--r--arch/microblaze/include/asm/uaccess.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 125e4cf4105c..b56d8ae9b17e 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -375,12 +375,24 @@ extern long __user_bad(void);
375extern unsigned long __copy_tofrom_user(void __user *to, 375extern unsigned long __copy_tofrom_user(void __user *to,
376 const void __user *from, unsigned long size); 376 const void __user *from, unsigned long size);
377 377
378#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n)) 378#define __copy_from_user(to, from, n) \
379 __copy_tofrom_user((__force void __user *)(to), \
380 (void __user *)(from), (n))
379#define __copy_from_user_inatomic(to, from, n) \ 381#define __copy_from_user_inatomic(to, from, n) \
380 copy_from_user((to), (from), (n)) 382 copy_from_user((to), (from), (n))
381 383
384static inline long copy_from_user(void *to,
385 const void __user *from, unsigned long n)
386{
387 might_sleep();
388 if (access_ok(VERIFY_READ, from, n))
389 return __copy_from_user(to, from, n);
390 else
391 return n;
392}
393
382#define __copy_to_user(to, from, n) \ 394#define __copy_to_user(to, from, n) \
383 __copy_tofrom_user((void __user *)(to), \ 395 __copy_tofrom_user((void __user *)(to), \
384 (__force const void __user *)(from), (n)) 396 (__force const void __user *)(from), (n))
385#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n)) 397#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n))
386 398
@@ -394,12 +406,6 @@ static inline long copy_to_user(void __user *to,
394 return n; 406 return n;
395} 407}
396 408
397#define copy_from_user(to, from, n) \
398 (access_ok(VERIFY_READ, (from), (n)) ? \
399 __copy_tofrom_user((__force void __user *)(to), \
400 (void __user *)(from), (n)) \
401 : -EFAULT)
402
403extern int __strncpy_user(char *to, const char __user *from, int len); 409extern int __strncpy_user(char *to, const char __user *from, int len);
404extern int __strnlen_user(const char __user *sstr, int len); 410extern int __strnlen_user(const char __user *sstr, int len);
405 411
@@ -411,7 +417,6 @@ extern int __strnlen_user(const char __user *sstr, int len);
411 417
412#endif /* CONFIG_MMU */ 418#endif /* CONFIG_MMU */
413 419
414
415#endif /* __ASSEMBLY__ */ 420#endif /* __ASSEMBLY__ */
416#endif /* __KERNEL__ */ 421#endif /* __KERNEL__ */
417 422