Skip to content

Commit bbef8e2

Browse files
author
Thomas Gleixner
committed
x86/percpu: Make CONFIG_USE_X86_SEG_SUPPORT work with sparse
Now that sparse builds enforce the usage of typeof_unqual() the casts in __raw_cpu_read/write() cause sparse to emit tons of false postive warnings: warning: cast removes address space '__percpu' of expression Address this by annotating the casts with __force. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/87v7gz0yjv.ffs@tglx Closes: https://lore.kernel.org/oe-kbuild-all/202601181733.YZOf9XU3-lkp@intel.com/
1 parent fd69b2f commit bbef8e2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

arch/x86/include/asm/percpu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@
137137

138138
#define __raw_cpu_read(size, qual, pcp) \
139139
({ \
140-
*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)); \
140+
*(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)); \
141141
})
142142

143-
#define __raw_cpu_write(size, qual, pcp, val) \
144-
do { \
145-
*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)) = (val); \
143+
#define __raw_cpu_write(size, qual, pcp, val) \
144+
do { \
145+
*(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val); \
146146
} while (0)
147147

148148
#define __raw_cpu_read_const(pcp) __raw_cpu_read(, , pcp)

0 commit comments

Comments
 (0)