Commit 9975f852 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/uaccess: Remove calls to __get_user_bad() and __put_user_bad()

__get_user_bad() and __put_user_bad() are functions that are
declared but not defined, in order to make the link fail in
case they are called.

Nowadays, we have BUILD_BUG() and BUILD_BUG_ON() for that, and
they have the advantage to break the build earlier as it breaks
it at compile time instead of link time.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/d7d839e994f49fae4ff7b70fac72bd951272436b.1615398265.git.christophe.leroy@csgroup.eu
parent 028e1561
...@@ -53,8 +53,6 @@ static inline bool __access_ok(unsigned long addr, unsigned long size) ...@@ -53,8 +53,6 @@ static inline bool __access_ok(unsigned long addr, unsigned long size)
#define __put_user(x, ptr) \ #define __put_user(x, ptr) \
__put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
extern long __put_user_bad(void);
#define __put_user_size(x, ptr, size, retval) \ #define __put_user_size(x, ptr, size, retval) \
do { \ do { \
__label__ __pu_failed; \ __label__ __pu_failed; \
...@@ -136,12 +134,10 @@ do { \ ...@@ -136,12 +134,10 @@ do { \
case 2: __put_user_asm_goto(x, __pus_addr, label, "sth"); break; \ case 2: __put_user_asm_goto(x, __pus_addr, label, "sth"); break; \
case 4: __put_user_asm_goto(x, __pus_addr, label, "stw"); break; \ case 4: __put_user_asm_goto(x, __pus_addr, label, "stw"); break; \
case 8: __put_user_asm2_goto(x, __pus_addr, label); break; \ case 8: __put_user_asm2_goto(x, __pus_addr, label); break; \
default: __put_user_bad(); \ default: BUILD_BUG(); \
} \ } \
} while (0) } while (0)
extern long __get_user_bad(void);
/* /*
* This does an atomic 128 byte aligned load from userspace. * This does an atomic 128 byte aligned load from userspace.
* Upto caller to do enable_kernel_vmx() before calling! * Upto caller to do enable_kernel_vmx() before calling!
...@@ -196,14 +192,13 @@ extern long __get_user_bad(void); ...@@ -196,14 +192,13 @@ extern long __get_user_bad(void);
#define __get_user_size_allowed(x, ptr, size, retval) \ #define __get_user_size_allowed(x, ptr, size, retval) \
do { \ do { \
retval = 0; \ retval = 0; \
if (size > sizeof(x)) \ BUILD_BUG_ON(size > sizeof(x)); \
(x) = __get_user_bad(); \
switch (size) { \ switch (size) { \
case 1: __get_user_asm(x, (u8 __user *)ptr, retval, "lbz"); break; \ case 1: __get_user_asm(x, (u8 __user *)ptr, retval, "lbz"); break; \
case 2: __get_user_asm(x, (u16 __user *)ptr, retval, "lhz"); break; \ case 2: __get_user_asm(x, (u16 __user *)ptr, retval, "lhz"); break; \
case 4: __get_user_asm(x, (u32 __user *)ptr, retval, "lwz"); break; \ case 4: __get_user_asm(x, (u32 __user *)ptr, retval, "lwz"); break; \
case 8: __get_user_asm2(x, (u64 __user *)ptr, retval); break; \ case 8: __get_user_asm2(x, (u64 __user *)ptr, retval); break; \
default: (x) = __get_user_bad(); \ default: BUILD_BUG(); \
} \ } \
} while (0) } while (0)
......
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