Skip to content

Commit

Permalink
sh: 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 c685238 commit 6e05050
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/sh/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
__kernel_size_t __copy_size = (__kernel_size_t) n;

if (__copy_size && __access_ok(__copy_from, __copy_size))
return __copy_user(to, from, __copy_size);
__copy_size = __copy_user(to, from, __copy_size);

if (unlikely(__copy_size))
memset(to + (n - __copy_size), 0, __copy_size);

return __copy_size;
}
Expand Down

0 comments on commit 6e05050

Please sign in to comment.