summaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-08-21 23:39:47 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-24 10:09:39 +0200
commitb93b47fdce1b846981c0cf1c186226c21630fcd9 (patch)
tree0405d6b6494ce97f6c910a5eacba408be2ad6c72 /arch/sh
parented4024b19a6aab26285936e3bcc29b62bd4e8a0c (diff)
downloadlinux-stable-b93b47fdce1b846981c0cf1c186226c21630fcd9.tar.gz
linux-stable-b93b47fdce1b846981c0cf1c186226c21630fcd9.tar.bz2
linux-stable-b93b47fdce1b846981c0cf1c186226c21630fcd9.zip
sh: fix copy_from_user()
commit 6e050503a150b2126620c1a1e9b3a368fcd51eac upstream. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/include/asm/uaccess.h5
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)
__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;
}