Re: arch/arm/kernel/hibernate.c:29:40: warning: array subscript -1 is outside array bounds of 'const void[2147483647]'

From: Linus Walleij
Date: Mon Nov 06 2023 - 08:19:49 EST


Hi Robot,

On Wed, Oct 18, 2023 at 2:17 PM kernel test robot <lkp@xxxxxxxxx> wrote:

> arch/arm/kernel/hibernate.c: In function 'pfn_is_nosave':
> >> arch/arm/kernel/hibernate.c:29:40: warning: array subscript -1 is outside array bounds of 'const void[2147483647]' [-Warray-bounds=]
> 29 | unsigned long nosave_end_pfn = virt_to_pfn(&__nosave_end - 1);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So the concern is that &__nosave_end could be 0 and the -1 would make
it wrap around?

It still has nothing to do with arrays, I don't get it.

Yours,
Linus Walleij