Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/

+4 -4
+4 -4
arch/x86/include/asm/percpu.h
··· 137 137 138 138 #define __raw_cpu_read(size, qual, pcp) \ 139 139 ({ \ 140 - *(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)); \ 140 + *(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)); \ 141 141 }) 142 142 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); \ 146 146 } while (0) 147 147 148 148 #define __raw_cpu_read_const(pcp) __raw_cpu_read(, , pcp)