[PATCH v2 4/5] uaccess: Disable -Wshadow in __scoped_user_access()

David Laight david.laight.linux at gmail.com
Tue Mar 3 01:12:12 PST 2026


On Mon, 2 Mar 2026 16:00:26 +0100
"Christophe Leroy (CS GROUP)" <chleroy at kernel.org> wrote:

> Le 02/03/2026 à 14:27, david.laight.linux at gmail.com a écrit :
> > From: David Laight <david.laight.linux at gmail.com>
> > 
> > -Wshadow is enabled by W=2 builds and __scoped_user_access() quite
> > deliberately creates a 'const' shadow of the 'user' address that
> > references a 'guard page' when the application passes a kernel pointer.
> > 
> > Signed-off-by: David Laight <david.laight.linux at gmail.com>  
> 
> There is a problem with this patch:

(badly line-wrapped errors deleted)

It seems to need gcc 12.
(So Linus is in luck.)

Prior to gcc 12 the #pragma generated by _Pragma() act as the
controlled statement of the for () loop.

Trying to put the _Pragma() inside the for statement doesn't work at all.

	David



More information about the linux-riscv mailing list