Commit 07f78b30 authored by Al Viro's avatar Al Viro

cris: don't rely upon __copy_user_zeroing() zeroing the tail

we want to get rid of it; unfortunately, it's tangled as hell, so
it'll take many steps, more's the pity.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a8be3445
...@@ -338,14 +338,16 @@ static inline size_t clear_user(void __user *to, size_t n) ...@@ -338,14 +338,16 @@ static inline size_t clear_user(void __user *to, size_t n)
static inline size_t copy_from_user(void *to, const void __user *from, size_t n) static inline size_t copy_from_user(void *to, const void __user *from, size_t n)
{ {
if (unlikely(!access_ok(VERIFY_READ, from, n))) { size_t res = n;
memset(to, 0, n); if (likely(access_ok(VERIFY_READ, from, n))) {
return n; if (__builtin_constant_p(n))
res = __constant_copy_from_user(to, from, n);
else
res = __copy_user_zeroing(to, from, n);
} }
if (__builtin_constant_p(n)) if (unlikely(res))
return __constant_copy_from_user(to, from, n); memset(to + n - res , 0, res);
else return res;
return __copy_user_zeroing(to, from, n);
} }
static inline size_t copy_to_user(void __user *to, const void *from, size_t n) static inline size_t copy_to_user(void __user *to, const void *from, size_t n)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment