summaryrefslogtreecommitdiff
path: root/arch/mips/include/asm/uaccess.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-03-20 18:54:21 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2017-04-06 09:08:08 +0300
commitab0aca27c4dfcfa72eb1339ae94edbfbdd751ae8 (patch)
tree6516a0e24baed276a2663cf046f383d178702ec4 /arch/mips/include/asm/uaccess.h
parentb0bb945c14e81b3b33075d59469d5bf5b736a4fb (diff)
downloadlinux-ab0aca27c4dfcfa72eb1339ae94edbfbdd751ae8.tar.xz
mips: make copy_from_user() zero tail explicitly
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/mips/include/asm/uaccess.h')
-rw-r--r--arch/mips/include/asm/uaccess.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index 9c05262a85f3..712dc40625b6 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -1080,29 +1080,29 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
({ \
void *__cu_to; \
const void __user *__cu_from; \
- long __cu_len; \
+ long __cu_len, __cu_res; \
\
__cu_to = (to); \
__cu_from = (from); \
- __cu_len = (n); \
+ __cu_res = __cu_len = (n); \
\
check_object_size(__cu_to, __cu_len, false); \
\
if (eva_kernel_access()) { \
- __cu_len = __invoke_copy_from_kernel(__cu_to, \
+ __cu_res = __invoke_copy_from_kernel(__cu_to, \
__cu_from, \
__cu_len); \
} else { \
if (access_ok(VERIFY_READ, __cu_from, __cu_len)) { \
might_fault(); \
- __cu_len = __invoke_copy_from_user(__cu_to, \
+ __cu_res = __invoke_copy_from_user(__cu_to, \
__cu_from, \
__cu_len); \
- } else { \
- memset(__cu_to, 0, __cu_len); \
} \
} \
- __cu_len; \
+ if (unlikely(__cu_res)) \
+ memset(__cu_to + __cu_len - __cu_res, 0, __cu_res); \
+ __cu_res; \
})
#define __copy_in_user(to, from, n) \