Skip to content

Commit

Permalink
parisc: fix copy_from_user()
Browse files Browse the repository at this point in the history
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Sep 13, 2016
1 parent acb2505 commit aace880
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/parisc/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <asm-generic/uaccess-unaligned.h>

#include <linux/bug.h>
#include <linux/string.h>

#define VERIFY_READ 0
#define VERIFY_WRITE 1
Expand Down Expand Up @@ -221,13 +222,14 @@ static inline unsigned long __must_check copy_from_user(void *to,
unsigned long n)
{
int sz = __compiletime_object_size(to);
int ret = -EFAULT;
unsigned long ret = n;

if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n))
ret = __copy_from_user(to, from, n);
else
copy_from_user_overflow();

if (unlikely(ret))
memset(to + (n - ret), 0, ret);
return ret;
}

Expand Down

0 comments on commit aace880

Please sign in to comment.