diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-21 23:39:47 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-13 17:50:15 -0400 |
| commit | 6e050503a150b2126620c1a1e9b3a368fcd51eac (patch) | |
| tree | 587e3e57d967e8e8b6be194d75fabf8ae36fde45 /arch/sh/include/asm | |
| parent | c6852389228df9fb3067f94f3b651de2a7921b36 (diff) | |
sh: fix copy_from_user()
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/sh/include/asm')
| -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 a49635c51266..92ade79ac427 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) | |||
| 151 | __kernel_size_t __copy_size = (__kernel_size_t) n; | 151 | __kernel_size_t __copy_size = (__kernel_size_t) n; |
| 152 | 152 | ||
| 153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) | 153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) |
| 154 | return __copy_user(to, from, __copy_size); | 154 | __copy_size = __copy_user(to, from, __copy_size); |
| 155 | |||
| 156 | if (unlikely(__copy_size)) | ||
| 157 | memset(to + (n - __copy_size), 0, __copy_size); | ||
| 155 | 158 | ||
| 156 | return __copy_size; | 159 | return __copy_size; |
| 157 | } | 160 | } |
