summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-09-09 19:16:58 -0400
committerSasha Levin <alexander.levin@verizon.com>2016-10-05 22:40:20 -0400
commitf27aa24d83767480930a97be76ff05e624ed81cd (patch)
tree344a3718f4d6e8ca0df34f7ec5947af90016fc60
parent9050993a5a2aff7b9088c7b10a673a210cfa463f (diff)
downloadlwn-f27aa24d83767480930a97be76ff05e624ed81cd.tar.gz
lwn-f27aa24d83767480930a97be76ff05e624ed81cd.zip
blackfin: fix copy_from_user()
[ Upstream commit 8f035983dd826d7e04f67b28acf8e2f08c347e41 ] Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
-rw-r--r--arch/blackfin/include/asm/uaccess.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h
index 57701c3b8a59..a992a788409c 100644
--- a/arch/blackfin/include/asm/uaccess.h
+++ b/arch/blackfin/include/asm/uaccess.h
@@ -177,11 +177,12 @@ static inline int bad_user_access_length(void)
static inline unsigned long __must_check
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);
- else
- return n;
- return 0;
+ return 0;
+ }
+ memset(to, 0, n);
+ return n;
}
static inline unsigned long __must_check