summaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-10-14 20:42:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-10-14 20:42:44 -0400
commit2692a71bbd40160165e89d5505c5c28144ec5a42 (patch)
treeacaaf0f1a4942486109094acad37c29456aeda98 /arch/arm/include
parent7041c57709efdc1e31aaff663cfe17f0b21f4743 (diff)
parentb065444286bed7ec49ee81c593a46f3031fbfc83 (diff)
downloadlinux-2692a71bbd40160165e89d5505c5c28144ec5a42.tar.gz
linux-2692a71bbd40160165e89d5505c5c28144ec5a42.tar.bz2
linux-2692a71bbd40160165e89d5505c5c28144ec5a42.zip
Merge branch 'work.uaccess' into for-linus
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/uaccess.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index a93c0f99acf7..1f59ea051bab 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -533,11 +533,12 @@ __clear_user(void __user *addr, unsigned long n)
static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
{
- if (access_ok(VERIFY_READ, from, n))
- n = __copy_from_user(to, from, n);
- else /* security hole - plug it */
- memset(to, 0, n);
- return n;
+ unsigned long res = n;
+ if (likely(access_ok(VERIFY_READ, from, n)))
+ res = __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)