diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-10 02:22:34 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-14 00:50:17 +0300 |
commit | d0cf385160c12abd109746cad1f13e3b3e8b50b8 (patch) | |
tree | ed39b065cc89614269e0265db0643a7b3802812e /arch/microblaze | |
parent | c90a3bc5061d57e7931a9b7ad14784e1a0ed497d (diff) | |
download | linux-d0cf385160c12abd109746cad1f13e3b3e8b50b8.tar.xz |
microblaze: fix copy_from_user()
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/include/asm/uaccess.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 331b0d35f89c..3a486d3b6f52 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h @@ -373,10 +373,13 @@ extern long __user_bad(void); static inline long copy_from_user(void *to, const void __user *from, unsigned long n) { + unsigned long res = n; might_fault(); - if (access_ok(VERIFY_READ, from, n)) - return __copy_from_user(to, from, n); - return n; + if (likely(access_ok(VERIFY_READ, from, n))) + res = __copy_from_user(to, from, n); + if (unlikely(res)) + memset(to + (n - res), 0, res); + return res; } #define __copy_to_user(to, from, n) \ |