Skip to content

Commit d0cf385

Browse files
author
Al Viro
committed
microblaze: fix copy_from_user()
Cc: [email protected] Signed-off-by: Al Viro <[email protected]>
1 parent c90a3bc commit d0cf385

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

arch/microblaze/include/asm/uaccess.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,13 @@ extern long __user_bad(void);
373373
static inline long copy_from_user(void *to,
374374
const void __user *from, unsigned long n)
375375
{
376+
unsigned long res = n;
376377
might_fault();
377-
if (access_ok(VERIFY_READ, from, n))
378-
return __copy_from_user(to, from, n);
379-
return n;
378+
if (likely(access_ok(VERIFY_READ, from, n)))
379+
res = __copy_from_user(to, from, n);
380+
if (unlikely(res))
381+
memset(to + (n - res), 0, res);
382+
return res;
380383
}
381384

382385
#define __copy_to_user(to, from, n) \

0 commit comments

Comments
 (0)