Commit f27aa24d authored by Al Viro's avatar Al Viro Committed by Sasha Levin

blackfin: fix copy_from_user()

[ Upstream commit 8f035983 ]

Cc: stable@vger.kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 9050993a
...@@ -177,11 +177,12 @@ static inline int bad_user_access_length(void) ...@@ -177,11 +177,12 @@ static inline int bad_user_access_length(void)
static inline unsigned long __must_check static inline unsigned long __must_check
copy_from_user(void *to, const void __user *from, unsigned long n) copy_from_user(void *to, const void __user *from, unsigned long n)
{ {
if (access_ok(VERIFY_READ, from, n)) if (likely(access_ok(VERIFY_READ, from, n))) {
memcpy(to, (const void __force *)from, n); memcpy(to, (const void __force *)from, n);
else return 0;
return n; }
return 0; memset(to, 0, n);
return n;
} }
static inline unsigned long __must_check static inline unsigned long __must_check
......
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