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

From: Yury Norov
Date: Thu May 23 2024 - 16:09:41 EST


On Thu, May 23, 2024 at 01:00:26PM -0700, Andrew Morton wrote:
> 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?

This is a real build breaker, so yes - I would like to have the fix in
this -rc. No preference regarding the tree.