diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-20 19:03:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-24 10:09:40 +0200 |
commit | e3d74efc704b0e05b79c6f0cdc97ea63453e2f8d (patch) | |
tree | 427bc5c037bb271a50cd5aebaba41a6d7b651aaf | |
parent | 462578faf789323dcf73602faed69624f50405a0 (diff) | |
download | lwn-e3d74efc704b0e05b79c6f0cdc97ea63453e2f8d.tar.gz lwn-e3d74efc704b0e05b79c6f0cdc97ea63453e2f8d.zip |
parisc: fix copy_from_user()
commit aace880feea38875fbc919761b77e5732a3659ef upstream.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/parisc/include/asm/uaccess.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index 0f59fd9ca205..37a1bee96444 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h @@ -10,6 +10,7 @@ #include <asm-generic/uaccess-unaligned.h> #include <linux/bug.h> +#include <linux/string.h> #define VERIFY_READ 0 #define VERIFY_WRITE 1 @@ -221,13 +222,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; } |