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

Linus Torvalds torvalds at linux-foundation.org
Mon Mar 2 09:17:48 PST 2026


On Mon, 2 Mar 2026 at 05:28, <david.laight.linux at gmail.com> wrote:
>
> 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.

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



More information about the linux-riscv mailing list