summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-08-21 23:39:47 -0400
committerSasha Levin <alexander.levin@verizon.com>2016-10-05 22:40:20 -0400
commit8bd2ef709d42a7c839c4ebf7c91f4dec2c90b6f6 (patch)
treee1c953471dfad2bc0953c3e4374c879faa43087d
parent94000fc8f4ab34b031caecdfcc767f478900a7bb (diff)
downloadlwn-8bd2ef709d42a7c839c4ebf7c91f4dec2c90b6f6.tar.gz
lwn-8bd2ef709d42a7c839c4ebf7c91f4dec2c90b6f6.zip
sh: fix copy_from_user()
[ Upstream commit 6e050503a150b2126620c1a1e9b3a368fcd51eac ] Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
-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 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;
}