aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/uaccess.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-09-10 16:50:00 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-09-15 19:51:56 -0400
commit4855bd255f9fb429d296dc3c620f1b563d20353e (patch)
tree3efb0a7b31da80ea65917bd7b5d8832576269bc3 /arch/arm64/include/asm/uaccess.h
parentarm: don't zero in __copy_from_user_inatomic()/__copy_from_user() (diff)
downloadlinux-dev-4855bd255f9fb429d296dc3c620f1b563d20353e.tar.xz
linux-dev-4855bd255f9fb429d296dc3c620f1b563d20353e.zip
arm64: don't zero in __copy_from_user{,_inatomic}
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r--arch/arm64/include/asm/uaccess.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index c47257c91b77..bcaf6fba1b65 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -278,14 +278,16 @@ static inline unsigned long __must_check __copy_to_user(void __user *to, const v
static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
{
+ unsigned long res = n;
kasan_check_write(to, n);
if (access_ok(VERIFY_READ, from, n)) {
check_object_size(to, n, false);
- n = __arch_copy_from_user(to, from, n);
- } else /* security hole - plug it */
- memset(to, 0, n);
- return n;
+ res = __arch_copy_from_user(to, from, n);
+ }
+ if (unlikely(res))
+ memset(to + (n - res), 0, res);
+ return res;
}
static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)