diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-25 18:36:22 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-03-28 18:24:04 -0400 |
commit | 122b05ddf506e637336dcf64b5a129825f7bf6d4 (patch) | |
tree | e8addfa4b5747e198698c0d54789b077cf2a92a0 /arch/x86/lib | |
parent | d597580d373774b1bdab84b3d26ff0b55162b916 (diff) |
amd64: get rid of zeroing
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/usercopy.c | 9 | ||||
-rw-r--r-- | arch/x86/lib/usercopy_64.c | 4 |
2 files changed, 5 insertions, 8 deletions
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c index c074799bddae..a851f3d199c2 100644 --- a/arch/x86/lib/usercopy.c +++ b/arch/x86/lib/usercopy.c @@ -76,10 +76,11 @@ EXPORT_SYMBOL(_copy_to_user); */ unsigned long _copy_from_user(void *to, const void __user *from, unsigned n) { + unsigned long res = n; if (access_ok(VERIFY_READ, from, n)) - n = __copy_from_user(to, from, n); - else - memset(to, 0, n); - return n; + res = __copy_from_user_inatomic(to, from, n); + if (unlikely(res)) + memset(to + n - res, 0, res); + return res; } EXPORT_SYMBOL(_copy_from_user); diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c index 69873589c0ba..6c8b6a6c1b38 100644 --- a/arch/x86/lib/usercopy_64.c +++ b/arch/x86/lib/usercopy_64.c @@ -80,9 +80,5 @@ copy_user_handle_tail(char *to, char *from, unsigned len) break; } clac(); - - /* If the destination is a kernel buffer, we always clear the end */ - if (!__addr_ok(to)) - memset(to, 0, len); return len; } |