Skip to content
Commit ec7633de authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kees Cook
Browse files

sparc: mark __arch_xchg() as __always_inline



An otherwise correct change to the atomic operations uncovered an
existing bug in the sparc __arch_xchg() function, which is calls
__xchg_called_with_bad_pointer() when its arguments are unknown at
compile time:

ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko] undefined!

This now happens because gcc determines that it's better to not inline the
function. Avoid this by just marking the function as __always_inline
to force the compiler to do the right thing here.

Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/all/c525adc9-6623-4660-8718-e0c9311563b8@roeck-us.net/
Fixes: d12157ef

 ("locking/atomic: make atomic*_{cmp,}xchg optional")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20230628094938.2318171-1-arnd@kernel.org


Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent e0b7b208
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