diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-21 23:39:47 -0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2016-11-20 01:17:29 +0000 |
commit | e873e0e70d2fc95f6ead7310bd39e4315a0f4998 (patch) | |
tree | f0911e2c6ed37ceaf54776715bb8d47aab769a10 | |
parent | 47b71752a6423c446156cb4e7be18b928482fdc5 (diff) |
sh: fix copy_from_user()
commit 6e050503a150b2126620c1a1e9b3a368fcd51eac upstream.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | arch/sh/include/asm/uaccess.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 9486376605f4..c04cc18ae9cd 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h @@ -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; } |