[mkp-scsi:for-next 26/50] include/linux/find.h:40:23: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'}
From: kernel test robot
Date: Tue Aug 23 2022 - 03:41:32 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
head: 8750aa54da43c0b50ea22f2f294dc834035b2146
commit: 434726c4b89ca25a278e548cf1034e6e22241723 [26/50] scsi: mpi3mr: Refresh SAS ports during soft reset
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220823/202208231557.N1l7dulw-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?id=434726c4b89ca25a278e548cf1034e6e22241723
git remote add mkp-scsi https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
git fetch --no-tags mkp-scsi for-next
git checkout 434726c4b89ca25a278e548cf1034e6e22241723
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/scsi/mpi3mr/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
In file included from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from arch/x86/include/asm/cpumask.h:5,
from arch/x86/include/asm/msr.h:11,
from arch/x86/include/asm/processor.h:22,
from arch/x86/include/asm/cpufeature.h:5,
from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:60,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:55,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/blk_types.h:10,
from include/linux/blkdev.h:9,
from drivers/scsi/mpi3mr/mpi3mr.h:13,
from drivers/scsi/mpi3mr/mpi3mr_transport.c:10:
drivers/scsi/mpi3mr/mpi3mr_transport.c: In function 'mpi3mr_update_mr_sas_port':
>> include/linux/find.h:40:23: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'} [-Warray-bounds]
40 | val = *addr & GENMASK(size - 1, offset);
| ^~~~~
drivers/scsi/mpi3mr/mpi3mr_transport.c:1610:27: note: while referencing 'phys_to_be_added'
1610 | u32 phy_mask_xor, phys_to_be_added, phys_to_be_removed;
| ^~~~~~~~~~~~~~~~
In file included from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from arch/x86/include/asm/cpumask.h:5,
from arch/x86/include/asm/msr.h:11,
from arch/x86/include/asm/processor.h:22,
from arch/x86/include/asm/cpufeature.h:5,
from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:60,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:55,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/blk_types.h:10,
from include/linux/blkdev.h:9,
from drivers/scsi/mpi3mr/mpi3mr.h:13,
from drivers/scsi/mpi3mr/mpi3mr_transport.c:10:
>> include/linux/find.h:40:23: warning: array subscript 'long unsigned int[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'} [-Warray-bounds]
40 | val = *addr & GENMASK(size - 1, offset);
| ^~~~~
drivers/scsi/mpi3mr/mpi3mr_transport.c:1610:45: note: while referencing 'phys_to_be_removed'
1610 | u32 phy_mask_xor, phys_to_be_added, phys_to_be_removed;
| ^~~~~~~~~~~~~~~~~~
vim +40 include/linux/find.h
5c88af59f9abc20 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 19
19de85ef574c3a2 include/asm-generic/bitops/find.h Akinobu Mita 2011-05-26 20 #ifndef find_next_bit
d852a6afd91fc92 include/asm-generic/bitops/find.h Akinobu Mita 2010-09-29 21 /**
d852a6afd91fc92 include/asm-generic/bitops/find.h Akinobu Mita 2010-09-29 22 * find_next_bit - find the next set bit in a memory region
d852a6afd91fc92 include/asm-generic/bitops/find.h Akinobu Mita 2010-09-29 23 * @addr: The address to base the search on
d852a6afd91fc92 include/asm-generic/bitops/find.h Akinobu Mita 2010-09-29 24 * @size: The bitmap size in bits
6d7131bd52b3e0d include/linux/find.h Anna-Maria Behnsen 2022-04-11 25 * @offset: The bitnumber to start searching at
ec778edf97dcaa5 include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12 26 *
ec778edf97dcaa5 include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12 27 * Returns the bit number for the next set bit
ec778edf97dcaa5 include/asm-generic/bitops/find.h Cody P Schafer 2013-11-12 28 * If no bits are set, returns @size.
d852a6afd91fc92 include/asm-generic/bitops/find.h Akinobu Mita 2010-09-29 29 */
5c88af59f9abc20 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 30 static inline
5c88af59f9abc20 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 31 unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
5c88af59f9abc20 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 32 unsigned long offset)
5c88af59f9abc20 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 33 {
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 34 if (small_const_nbits(size)) {
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 35 unsigned long val;
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 36
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 37 if (unlikely(offset >= size))
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 38 return size;
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 39
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 @40 val = *addr & GENMASK(size - 1, offset);
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 41 return val ? __ffs(val) : size;
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 42 }
277a20a498d3075 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 43
5c88af59f9abc20 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 44 return _find_next_bit(addr, NULL, size, offset, 0UL, 0);
5c88af59f9abc20 include/asm-generic/bitops/find.h Yury Norov 2021-05-06 45 }
19de85ef574c3a2 include/asm-generic/bitops/find.h Akinobu Mita 2011-05-26 46 #endif
c7f612cdf091def include/asm-generic/bitops/find.h Akinobu Mita 2006-03-26 47
:::::: The code at line 40 was first introduced by commit
:::::: 277a20a498d30753f5d8a607dbf967bc163552c1 lib: add fast path for find_next_*_bit()
:::::: TO: Yury Norov <yury.norov@xxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://01.org/lkp