diff options
-rw-r--r-- | arch/s390/kvm/gaccess.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h index 302e0e52b009..99d789e8a018 100644 --- a/arch/s390/kvm/gaccess.h +++ b/arch/s390/kvm/gaccess.h | |||
@@ -42,9 +42,11 @@ static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu, | |||
42 | ({ \ | 42 | ({ \ |
43 | __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\ | 43 | __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\ |
44 | int __mask = sizeof(__typeof__(*(gptr))) - 1; \ | 44 | int __mask = sizeof(__typeof__(*(gptr))) - 1; \ |
45 | int __ret = PTR_RET((void __force *)__uptr); \ | 45 | int __ret; \ |
46 | \ | 46 | \ |
47 | if (!__ret) { \ | 47 | if (IS_ERR((void __force *)__uptr)) { \ |
48 | __ret = PTR_ERR((void __force *)__uptr); \ | ||
49 | } else { \ | ||
48 | BUG_ON((unsigned long)__uptr & __mask); \ | 50 | BUG_ON((unsigned long)__uptr & __mask); \ |
49 | __ret = get_user(x, __uptr); \ | 51 | __ret = get_user(x, __uptr); \ |
50 | } \ | 52 | } \ |
@@ -55,9 +57,11 @@ static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu, | |||
55 | ({ \ | 57 | ({ \ |
56 | __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\ | 58 | __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\ |
57 | int __mask = sizeof(__typeof__(*(gptr))) - 1; \ | 59 | int __mask = sizeof(__typeof__(*(gptr))) - 1; \ |
58 | int __ret = PTR_RET((void __force *)__uptr); \ | 60 | int __ret; \ |
59 | \ | 61 | \ |
60 | if (!__ret) { \ | 62 | if (IS_ERR((void __force *)__uptr)) { \ |
63 | __ret = PTR_ERR((void __force *)__uptr); \ | ||
64 | } else { \ | ||
61 | BUG_ON((unsigned long)__uptr & __mask); \ | 65 | BUG_ON((unsigned long)__uptr & __mask); \ |
62 | __ret = put_user(x, __uptr); \ | 66 | __ret = put_user(x, __uptr); \ |
63 | } \ | 67 | } \ |