summaryrefslogtreecommitdiff
path: root/arch/metag/include
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-04-05 11:41:09 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-04-05 11:41:09 -0400
commita98bba563d262065f230193c4b56c6758e8b4c3b (patch)
tree8c500567a5aedf8613e03ed31c6660a7014b3a82 /arch/metag/include
parent2c3054176e2ef3f49be9ec8b6fd06d6a47156ff5 (diff)
parentb884a190afcecdbef34ca508ea5ee88bb7c77861 (diff)
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag into uaccess.metag
Diffstat (limited to 'arch/metag/include')
-rw-r--r--arch/metag/include/asm/uaccess.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/metag/include/asm/uaccess.h b/arch/metag/include/asm/uaccess.h
index 2613d91bde1a..61805d9f9375 100644
--- a/arch/metag/include/asm/uaccess.h
+++ b/arch/metag/include/asm/uaccess.h
@@ -172,20 +172,21 @@ extern long __must_check strnlen_user(const char __user *src, long count);
#define strlen_user(str) strnlen_user(str, 32767)
-extern unsigned long __must_check __copy_user_zeroing(void *to,
- const void __user *from,
- unsigned long n);
+extern unsigned long raw_copy_from_user(void *to, const void __user *from,
+ unsigned long n);
static inline unsigned long
copy_from_user(void *to, const void __user *from, unsigned long n)
{
+ unsigned long res = n;
if (likely(access_ok(VERIFY_READ, from, n)))
- return __copy_user_zeroing(to, from, n);
- memset(to, 0, n);
- return n;
+ res = raw_copy_from_user(to, from, n);
+ if (unlikely(res))
+ memset(to + (n - res), 0, res);
+ return res;
}
-#define __copy_from_user(to, from, n) __copy_user_zeroing(to, from, n)
+#define __copy_from_user(to, from, n) raw_copy_from_user(to, from, n)
#define __copy_from_user_inatomic __copy_from_user
extern unsigned long __must_check __copy_user(void __user *to,