Commit 9776e386 authored by Luc Van Oostenryck's avatar Luc Van Oostenryck Committed by akpm

ia64: fix sparse warnings with cmpxchg() & xchg()

On IA64, new sparse's warnings where issued after fixing some __rcu
annotations in kernel/bpf/.

These new warnings are false positives and appear on IA64 because on this
architecture, the macros for cmpxchg() and xchg() make casts that ignore
sparse annotations.

This patch contains the minimal patch to fix this issue: adding a missing
cast and some missing '__force'.

Link: https://lore.kernel.org/r/20220601120013.bq5a3ynbkc3hngm5@mail
Link: https://lkml.kernel.org/r/20220605160738.79736-1-luc.vanoostenryck@gmail.comSigned-off-by: default avatarLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Acked-by: default avatarPaul E. McKenney <paulmck@kernel.org>
Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 4815a360
...@@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void); ...@@ -33,24 +33,24 @@ extern void ia64_xchg_called_with_bad_pointer(void);
\ \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
__xchg_result = ia64_xchg1((__u8 *)ptr, x); \ __xchg_result = ia64_xchg1((__u8 __force *)ptr, x); \
break; \ break; \
\ \
case 2: \ case 2: \
__xchg_result = ia64_xchg2((__u16 *)ptr, x); \ __xchg_result = ia64_xchg2((__u16 __force *)ptr, x); \
break; \ break; \
\ \
case 4: \ case 4: \
__xchg_result = ia64_xchg4((__u32 *)ptr, x); \ __xchg_result = ia64_xchg4((__u32 __force *)ptr, x); \
break; \ break; \
\ \
case 8: \ case 8: \
__xchg_result = ia64_xchg8((__u64 *)ptr, x); \ __xchg_result = ia64_xchg8((__u64 __force *)ptr, x); \
break; \ break; \
default: \ default: \
ia64_xchg_called_with_bad_pointer(); \ ia64_xchg_called_with_bad_pointer(); \
} \ } \
__xchg_result; \ (__typeof__ (*(ptr)) __force) __xchg_result; \
}) })
#ifndef __KERNEL__ #ifndef __KERNEL__
...@@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void); ...@@ -76,42 +76,42 @@ extern long ia64_cmpxchg_called_with_bad_pointer(void);
\ \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
_o_ = (__u8) (long) (old); \ _o_ = (__u8) (long __force) (old); \
break; \ break; \
case 2: \ case 2: \
_o_ = (__u16) (long) (old); \ _o_ = (__u16) (long __force) (old); \
break; \ break; \
case 4: \ case 4: \
_o_ = (__u32) (long) (old); \ _o_ = (__u32) (long __force) (old); \
break; \ break; \
case 8: \ case 8: \
_o_ = (__u64) (long) (old); \ _o_ = (__u64) (long __force) (old); \
break; \ break; \
default: \ default: \
break; \ break; \
} \ } \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
_r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \ _r_ = ia64_cmpxchg1_##sem((__u8 __force *) ptr, new, _o_); \
break; \ break; \
\ \
case 2: \ case 2: \
_r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \ _r_ = ia64_cmpxchg2_##sem((__u16 __force *) ptr, new, _o_); \
break; \ break; \
\ \
case 4: \ case 4: \
_r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \ _r_ = ia64_cmpxchg4_##sem((__u32 __force *) ptr, new, _o_); \
break; \ break; \
\ \
case 8: \ case 8: \
_r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \ _r_ = ia64_cmpxchg8_##sem((__u64 __force *) ptr, new, _o_); \
break; \ break; \
\ \
default: \ default: \
_r_ = ia64_cmpxchg_called_with_bad_pointer(); \ _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
break; \ break; \
} \ } \
(__typeof__(old)) _r_; \ (__typeof__(old) __force) _r_; \
}) })
#define cmpxchg_acq(ptr, o, n) \ #define cmpxchg_acq(ptr, o, n) \
......
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