aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/microblaze/include/asm/uaccess.h9
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);
373static inline long copy_from_user(void *to, 373static inline long copy_from_user(void *to,
374 const void __user *from, unsigned long n) 374 const void __user *from, unsigned long n)
375{ 375{
376 unsigned long res = n;
376 might_fault(); 377 might_fault();
377 if (access_ok(VERIFY_READ, from, n)) 378 if (likely(access_ok(VERIFY_READ, from, n)))
378 return __copy_from_user(to, from, n); 379 res = __copy_from_user(to, from, n);
379 return n; 380 if (unlikely(res))
381 memset(to + (n - res), 0, res);
382 return res;
380} 383}
381 384
382#define __copy_to_user(to, from, n) \ 385#define __copy_to_user(to, from, n) \