Commit 6fd4725d authored by Glauber Costa's avatar Glauber Costa Committed by Ingo Molnar

x86: don't always use EFAULT on __get_user_size.

Let the user of the macro specify the desired return.
Signed-off-by: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent dc70ddf4
...@@ -61,27 +61,27 @@ extern void __put_user_bad(void); ...@@ -61,27 +61,27 @@ extern void __put_user_bad(void);
({ \ ({ \
int __gu_err; \ int __gu_err; \
unsigned long __gu_val; \ unsigned long __gu_val; \
__get_user_size(__gu_val, (ptr), (size), __gu_err); \ __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT);\
(x) = (__force typeof(*(ptr)))__gu_val; \ (x) = (__force typeof(*(ptr)))__gu_val; \
__gu_err; \ __gu_err; \
}) })
#define __get_user_size(x, ptr, size, retval) \ #define __get_user_size(x, ptr, size, retval, errret) \
do { \ do { \
retval = 0; \ retval = 0; \
__chk_user_ptr(ptr); \ __chk_user_ptr(ptr); \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
__get_user_asm(x, ptr, retval, "b", "b", "=q", -EFAULT);\ __get_user_asm(x, ptr, retval, "b", "b", "=q", errret);\
break; \ break; \
case 2: \ case 2: \
__get_user_asm(x, ptr, retval, "w", "w", "=r", -EFAULT);\ __get_user_asm(x, ptr, retval, "w", "w", "=r", errret);\
break; \ break; \
case 4: \ case 4: \
__get_user_asm(x, ptr, retval, "l", "k", "=r", -EFAULT);\ __get_user_asm(x, ptr, retval, "l", "k", "=r", errret);\
break; \ break; \
case 8: \ case 8: \
__get_user_asm(x, ptr, retval, "q", "", "=r", -EFAULT); \ __get_user_asm(x, ptr, retval, "q", "", "=r", errret); \
break; \ break; \
default: \ default: \
(x) = __get_user_bad(); \ (x) = __get_user_bad(); \
......
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