Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit ec7633d

Browse files
arndbkees
authored andcommitted
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: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Fixes: d12157e ("locking/atomic: make atomic*_{cmp,}xchg optional") Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Acked-by: Mark Rutland <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Acked-by: Guenter Roeck <[email protected]> Acked-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent e0b7b20 commit ec7633d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/sparc/include/asm/cmpxchg_32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
unsigned long __xchg_u32(volatile u32 *m, u32 new);
1616
void __xchg_called_with_bad_pointer(void);
1717

18-
static inline unsigned long __arch_xchg(unsigned long x, __volatile__ void * ptr, int size)
18+
static __always_inline unsigned long __arch_xchg(unsigned long x, __volatile__ void * ptr, int size)
1919
{
2020
switch (size) {
2121
case 4:

arch/sparc/include/asm/cmpxchg_64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ xchg16(__volatile__ unsigned short *m, unsigned short val)
8787
return (load32 & mask) >> bit_shift;
8888
}
8989

90-
static inline unsigned long
90+
static __always_inline unsigned long
9191
__arch_xchg(unsigned long x, __volatile__ void * ptr, int size)
9292
{
9393
switch (size) {

0 commit comments

Comments
 (0)