diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-21 23:39:47 -0400 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2016-09-29 11:14:33 +0200 |
commit | 49e361884efedb0786751217b0da7f78c263265e (patch) | |
tree | 29ef614ffcd4aedf8765598635158a19a957d130 | |
parent | 20f17babfafe6641a200b49b572e61464c475a99 (diff) | |
download | lwn-49e361884efedb0786751217b0da7f78c263265e.tar.gz lwn-49e361884efedb0786751217b0da7f78c263265e.zip |
sh: fix copy_from_user()
commit 6e050503a150b2126620c1a1e9b3a368fcd51eac upstream.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-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; } |