lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <31da0378-59be-42fc-a813-be3946d2b504@gmail.com>
Date: Sun, 18 Jan 2026 18:25:46 +0100
From: Uros Bizjak <ubizjak@...il.com>
To: Thomas Gleixner <tglx@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Cc: x86@...nel.org
Subject: Re: [PATCH] x86/percpu: Make CONFIG_USE_X86_SEG_SUPPORT work with
 sparse



On 1/18/26 15:45, Thomas Gleixner wrote:
> 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@...el.com>
> Signed-off-by: Thomas Gleixner <tglx@...nel.org>
> Closes: https://lore.kernel.org/oe-kbuild-all/202601181733.YZOf9XU3-lkp@intel.com/
> ---
>   arch/x86/include/asm/percpu.h |    8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> --- a/arch/x86/include/asm/percpu.h
> +++ b/arch/x86/include/asm/percpu.h
> @@ -137,12 +137,12 @@
>   
>   #define __raw_cpu_read(size, qual, pcp)					\
>   ({									\
> -	*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp));		\
> +	*(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp));	\
>   })
>   
> -#define __raw_cpu_write(size, qual, pcp, val)				\
> -do {									\
> -	*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)) = (val);	\
> +#define __raw_cpu_write(size, qual, pcp, val)					\
> +do {										\
> +	*(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val);	\
>   } while (0)
>   
>   #define __raw_cpu_read_const(pcp)	__raw_cpu_read(, , pcp)

Perhaps these defines can be simplified a bit as:

#define __raw_cpu_read(size, qual, pcp) \
	(*(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)))

#define __raw_cpu_write(size, qual, pcp, val) \
	(*(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val))

Uros.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ