Re: [PATCH v2 4/5] uaccess: Disable -Wshadow in __scoped_user_access()
From: Linus Torvalds
Date: Mon Mar 02 2026 - 12:26:33 EST
On Mon, 2 Mar 2026 at 05:28, <david.laight.linux@xxxxxxxxx> wrote:
>
> From: David Laight <david.laight.linux@xxxxxxxxx>
>
> -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.
This is too ugly to live.
There is no way that we should make an already unreadable macro even
worse just because somebody - incorrectly - thinks that W=2 matters.
No - what matters a whole lot more is keeping the kernel sources
readable (well, at least as readable as is possible).
Because W=2 is one of those "you get what you deserve" things.
Linus