blackfin: fix copy_from_user()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 9 Sep 2016 23:16:58 +0000 (19:16 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 13 Sep 2016 21:50:16 +0000 (17:50 -0400)
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/blackfin/include/asm/uaccess.h

index 12f5d6851bbcb3e28c7ba5421a849df3cabbf4fd..0a2a70096d8b2dc7345b6e1ca85c68b3cdd39b9e 100644 (file)
@@ -171,11 +171,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)
 {
 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);
                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
 }
 
 static inline unsigned long __must_check