Skip to content

Commit

Permalink
microblaze: fix copy_from_user()
Browse files Browse the repository at this point in the history
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Sep 13, 2016
1 parent c90a3bc commit d0cf385
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/microblaze/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit d0cf385

Please sign in to comment.