diff options
author | Michal Simek <monstr@monstr.eu> | 2010-03-22 17:56:32 +0300 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2010-04-01 10:38:21 +0400 |
commit | 4270690bd4b1420a8d634ea31953a1c4def2a44a (patch) | |
tree | c0418abd19b4e0f9f854c8e05b916d1e0b9c49c8 /arch/microblaze | |
parent | cc5a428b7ae9c2d6233b5bf6b3e6fbb24ddd1ed5 (diff) | |
download | linux-4270690bd4b1420a8d634ea31953a1c4def2a44a.tar.xz |
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')
-rw-r--r-- | arch/microblaze/include/asm/uaccess.h | 23 |
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); extern unsigned long __copy_tofrom_user(void __user *to, const void __user *from, unsigned long size); -#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n)) +#define __copy_from_user(to, from, n) \ + __copy_tofrom_user((__force void __user *)(to), \ + (void __user *)(from), (n)) #define __copy_from_user_inatomic(to, from, n) \ copy_from_user((to), (from), (n)) +static inline long copy_from_user(void *to, + const void __user *from, unsigned long n) +{ + might_sleep(); + if (access_ok(VERIFY_READ, from, n)) + return __copy_from_user(to, from, n); + else + return n; +} + #define __copy_to_user(to, from, n) \ - __copy_tofrom_user((void __user *)(to), \ + __copy_tofrom_user((void __user *)(to), \ (__force const void __user *)(from), (n)) #define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n)) @@ -394,12 +406,6 @@ static inline long copy_to_user(void __user *to, return n; } -#define copy_from_user(to, from, n) \ - (access_ok(VERIFY_READ, (from), (n)) ? \ - __copy_tofrom_user((__force void __user *)(to), \ - (void __user *)(from), (n)) \ - : -EFAULT) - extern int __strncpy_user(char *to, const char __user *from, int len); extern int __strnlen_user(const char __user *sstr, int len); @@ -411,7 +417,6 @@ extern int __strnlen_user(const char __user *sstr, int len); #endif /* CONFIG_MMU */ - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ |