Commit 90ad0e49 authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman

nios2: fix __get_user()

commit 2e29f50a upstream.

a) should not leave crap on fault
b) should _not_ require access_ok() in any cases.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b668ad80
...@@ -139,7 +139,7 @@ extern long strnlen_user(const char __user *s, long n); ...@@ -139,7 +139,7 @@ extern long strnlen_user(const char __user *s, long n);
#define __get_user_unknown(val, size, ptr, err) do { \ #define __get_user_unknown(val, size, ptr, err) do { \
err = 0; \ err = 0; \
if (copy_from_user(&(val), ptr, size)) { \ if (__copy_from_user(&(val), ptr, size)) { \
err = -EFAULT; \ err = -EFAULT; \
} \ } \
} while (0) } while (0)
...@@ -166,7 +166,7 @@ do { \ ...@@ -166,7 +166,7 @@ do { \
({ \ ({ \
long __gu_err = -EFAULT; \ long __gu_err = -EFAULT; \
const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \
unsigned long __gu_val; \ unsigned long __gu_val = 0; \
__get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\
(x) = (__force __typeof__(x))__gu_val; \ (x) = (__force __typeof__(x))__gu_val; \
__gu_err; \ __gu_err; \
......
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