Re: [alobakin:pfcp 11/19] include/linux/bitmap.h:642:17: warning: array subscript [1, 1024] is outside array bounds of 'long unsigned int[1]'

From: Yury Norov
Date: Tue Nov 07 2023 - 08:22:29 EST


On Mon, Nov 06, 2023 at 05:31:34PM +0100, Alexander Lobakin wrote:
> BTW, I have this in my inbox:
>
> From: Kernel Test Robot <lkp@xxxxxxxxx>
> Date: Tue, 17 Oct 2023 08:14:51 +0800
>
> > tree: https://github.com/alobakin/linux pfcp
> > head: 9183a3eb639912169a3d3e2be4f25556b465919b
> > commit: c8a652cdcc0964510f108726b3da0784d1bc0cd2 [11/19] bitmap: make bitmap_{get,set}_value8() use bitmap_{read,write}()
>
> So it happened after I converted bitmap_{get,set}_value8() so that they
> use bitmap_{read,write}().
>
> > config: x86_64-randconfig-004-20231017 (https://download.01.org/0day-ci/archive/20231017/202310170708.fJzLlgDM-lkp@xxxxxxxxx/config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231017/202310170708.fJzLlgDM-lkp@xxxxxxxxx/reproduce)

[...]

> > 643 | map[index + 1] |= (value >> space);
> > | ^~
> > In file included from include/linux/kasan-checks.h:5,
> > from include/asm-generic/rwonce.h:26,
> > from ./arch/x86/include/generated/asm/rwonce.h:1,
> > from include/linux/compiler.h:246,
> > from include/linux/build_bug.h:5,
> > from include/linux/bits.h:21,
> > from include/linux/ioport.h:13,
> > from include/linux/acpi.h:12,
> > from drivers/gpio/gpio-pca953x.c:11:
> > drivers/gpio/gpio-pca953x.c:1032:17: note: while referencing 'val'

It looks like a gcc-9 false-positive. I tried gcc-12 and gcc-13, and
they both looks OK. Below is the fix that works for me.

Can you please test the following patch and add it to your series?

Thanks,
Yury