[xilinx-xlnx:master 943/1117] include/linux/mtd/spi-nor.h:429:27: warning: array subscript 2 is above array bounds of 'struct spi_nor_flash_parameter * const[2]'

kernel test robot lkp at intel.com
Fri Apr 21 18:54:36 PDT 2023


tree:   https://github.com/Xilinx/linux-xlnx master
head:   3a2a9dcee70777a85b3952269c47e6eb65779b78
commit: 0d4f3cd4205e0e41ba21a00507fb6afb7d3d2ca4 [943/1117] mtd: spi-nor: Add stacked memories support in spi-nor
config: i386-randconfig-a001 (https://download.01.org/0day-ci/archive/20230422/202304220923.sh7Zt2zC-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/Xilinx/linux-xlnx/commit/0d4f3cd4205e0e41ba21a00507fb6afb7d3d2ca4
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx master
        git checkout 0d4f3cd4205e0e41ba21a00507fb6afb7d3d2ca4
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/mtd/spi-nor/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp at intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304220923.sh7Zt2zC-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/mtd/spi-nor/core.c:23:
   drivers/mtd/spi-nor/core.c: In function 'spi_nor_read.part.0':
>> include/linux/mtd/spi-nor.h:429:27: warning: array subscript 2 is above array bounds of 'struct spi_nor_flash_parameter * const[2]' [-Warray-bounds]
     429 |         return nor->params[idx];
         |                ~~~~~~~~~~~^~~~~
   include/linux/mtd/spi-nor.h:406:41: note: while referencing 'params'
     406 |         struct spi_nor_flash_parameter *params[SNOR_FLASH_CNT_MAX];
         |                                         ^~~~~~
   drivers/mtd/spi-nor/core.c: In function 'spi_nor_write':
>> include/linux/mtd/spi-nor.h:429:27: warning: array subscript 2 is above array bounds of 'struct spi_nor_flash_parameter * const[2]' [-Warray-bounds]
     429 |         return nor->params[idx];
         |                ~~~~~~~~~~~^~~~~
   include/linux/mtd/spi-nor.h:406:41: note: while referencing 'params'
     406 |         struct spi_nor_flash_parameter *params[SNOR_FLASH_CNT_MAX];
         |                                         ^~~~~~
   drivers/mtd/spi-nor/core.c: In function 'spi_nor_erase':
>> include/linux/mtd/spi-nor.h:429:27: warning: array subscript 2 is above array bounds of 'struct spi_nor_flash_parameter * const[2]' [-Warray-bounds]
     429 |         return nor->params[idx];
         |                ~~~~~~~~~~~^~~~~
   include/linux/mtd/spi-nor.h:406:41: note: while referencing 'params'
     406 |         struct spi_nor_flash_parameter *params[SNOR_FLASH_CNT_MAX];
         |                                         ^~~~~~
>> include/linux/mtd/spi-nor.h:429:27: warning: array subscript 2 is above array bounds of 'struct spi_nor_flash_parameter * const[2]' [-Warray-bounds]
     429 |         return nor->params[idx];
         |                ~~~~~~~~~~~^~~~~
   include/linux/mtd/spi-nor.h:406:41: note: while referencing 'params'
     406 |         struct spi_nor_flash_parameter *params[SNOR_FLASH_CNT_MAX];
         |                                         ^~~~~~


vim +429 include/linux/mtd/spi-nor.h

   426	
   427	static inline struct spi_nor_flash_parameter *spi_nor_get_params(const struct spi_nor *nor, u8 idx)
   428	{
 > 429		return nor->params[idx];
   430	}
   431	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests



More information about the linux-arm-kernel mailing list