diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-20 19:03:37 -0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2016-11-20 01:17:28 +0000 |
commit | cad7af985ef8b9c50e9a97e95a4a75058486a370 (patch) | |
tree | ee7889c9163383bda79c0ead8fc3414388ef6063 /arch/parisc | |
parent | 71b9826d49cfb7d00800f1e44df9cee39402d38e (diff) | |
download | linux-stable-cad7af985ef8b9c50e9a97e95a4a75058486a370.tar.gz linux-stable-cad7af985ef8b9c50e9a97e95a4a75058486a370.tar.bz2 linux-stable-cad7af985ef8b9c50e9a97e95a4a75058486a370.zip |
parisc: fix copy_from_user()
commit aace880feea38875fbc919761b77e5732a3659ef upstream.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'arch/parisc')
-rw-r--r-- | arch/parisc/include/asm/uaccess.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index de2db1910755..9392458b6e86 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h @@ -9,6 +9,8 @@ #include <asm/errno.h> #include <asm-generic/uaccess-unaligned.h> +#include <linux/string.h> + #define VERIFY_READ 0 #define VERIFY_WRITE 1 @@ -248,13 +250,14 @@ static inline unsigned long __must_check copy_from_user(void *to, unsigned long n) { int sz = __compiletime_object_size(to); - int ret = -EFAULT; + unsigned long ret = n; if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n)) ret = __copy_from_user(to, from, n); else copy_from_user_overflow(); - + if (unlikely(ret)) + memset(to + (n - ret), 0, ret); return ret; } |