Re: [PATCH] gcc: disable '-Warray-bounds' for gcc-9

From: Andrew Morton
Date: Thu May 23 2024 - 16:00:32 EST


On Wed, 22 May 2024 15:58:30 -0700 Yury Norov <yury.norov@xxxxxxxxx> wrote:

> '-Warray-bounds' is already disabled for gcc-10+. Now that we've merged
> bitmap_{read,write), I see the following error when building the kernel
> with gcc-9.4 (Ubuntu 20.04.4 LTS) for x86_64 allmodconfig:
>
> drivers/pinctrl/pinctrl-cy8c95x0.c: In function ‘cy8c95x0_read_regs_mask.isra.0’:
> include/linux/bitmap.h:756:18: error: array subscript [1, 288230376151711744] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
> 756 | value_high = map[index + 1] & BITMAP_LAST_WORD_MASK(start + nbits);
> | ~~~^~~~~~~~~~~
>
> The immediate reason is that the commit b44759705f7d ("bitmap: make
> bitmap_{get,set}_value8() use bitmap_{read,write}()") switched the
> bitmap_get_value8() to an alias of bitmap_read(); the same for 'set'.

So it seems that all kernels which contain b44759705f7d should have
this change? If so, and as b44759705f7d appears to be in the net tree
then the net tree is a suitable place to carry this patch?

Or I can send it into Linus this -rc cycle and things will sort themselves out.

Thoughts?