Re: [PATCH] mm/vmscan: avoid false-positive -Wuninitialized warning

From: Arnd Bergmann

Date: Fri Feb 13 2026 - 12:07:38 EST


On Fri, Feb 13, 2026, at 17:58, Andrew Morton wrote:
> On Fri, 13 Feb 2026 13:38:56 +0100 Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> When the -fsanitize=bounds sanitizer is enabled,
>
> Is this an option in current kernels?

Yes, this is CONFIG_UBSAN_ARRAY_BOUNDS. The actual warning
only shows up in some configurations with that, so either there
is some other dependency, or an element of chance based on gcc
optimizations.

> Seems a large change just to squish a compiler warning. People might
> prefer a simple
>
> - struct ctrl_pos sp, pv;
> + struct ctrl_pos sp, pv = {};

Right, that would clearly also shut up the warning.

To me this seems less intuitive without an extra comment,
since read_ctrl_pos() is meant to initialize the entire
struct, but please pick whichever you find most readable
here.

Arnd