[gustavoars-linux:for-next/Warray-bounds 1/1] arch/sparc/kernel/irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]'

From: kernel test robot
Date: Thu Jul 15 2021 - 08:21:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git for-next/Warray-bounds
head: 0d6455c92b82b36e29e5206a46329058d75fbc33
commit: 0d6455c92b82b36e29e5206a46329058d75fbc33 [1/1] Makefile: Enable -Warray-bounds
config: sparc-randconfig-p002-20210715 (attached as .config)
compiler: sparc-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=0d6455c92b82b36e29e5206a46329058d75fbc33
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux for-next/Warray-bounds
git checkout 0d6455c92b82b36e29e5206a46329058d75fbc33
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=sparc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/sparc/kernel/irq_32.c: In function 'sparc_floppy_request_irq':
>> arch/sparc/kernel/irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
258 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_one = SPARC_RD_PSR_L0; \
| ^
arch/sparc/kernel/irq_32.c:272:3: note: in expansion of macro 'INSTANTIATE'
272 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:143:24: note: while referencing 'trapbase_cpu1'
143 | extern struct tt_entry trapbase_cpu1;
| ^~~~~~~~~~~~~
In file included from arch/sparc/include/asm/traps.h:10,
from arch/sparc/kernel/kernel.h:8,
from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/irq_32.c:261:25: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
261 | (unsigned long) &table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two);\
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/sparc/include/uapi/asm/traps.h:27:38: note: in definition of macro 'SPARC_BRANCH'
27 | (0x10800000 | (((dest_addr-inst_addr)>>2)&0x3fffff))
| ^~~~~~~~~
arch/sparc/kernel/irq_32.c:272:3: note: in expansion of macro 'INSTANTIATE'
272 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:143:24: note: while referencing 'trapbase_cpu1'
143 | extern struct tt_entry trapbase_cpu1;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:259:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
259 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two = \
| ^
arch/sparc/kernel/irq_32.c:272:3: note: in expansion of macro 'INSTANTIATE'
272 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:143:24: note: while referencing 'trapbase_cpu1'
143 | extern struct tt_entry trapbase_cpu1;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:262:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
262 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_three = SPARC_RD_WIM_L3; \
| ^
arch/sparc/kernel/irq_32.c:272:3: note: in expansion of macro 'INSTANTIATE'
272 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:143:24: note: while referencing 'trapbase_cpu1'
143 | extern struct tt_entry trapbase_cpu1;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:263:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
263 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP;
| ^
arch/sparc/kernel/irq_32.c:272:3: note: in expansion of macro 'INSTANTIATE'
272 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:143:24: note: while referencing 'trapbase_cpu1'
143 | extern struct tt_entry trapbase_cpu1;
| ^~~~~~~~~~~~~
>> arch/sparc/kernel/irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
258 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_one = SPARC_RD_PSR_L0; \
| ^
arch/sparc/kernel/irq_32.c:274:3: note: in expansion of macro 'INSTANTIATE'
274 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:144:24: note: while referencing 'trapbase_cpu2'
144 | extern struct tt_entry trapbase_cpu2;
| ^~~~~~~~~~~~~
In file included from arch/sparc/include/asm/traps.h:10,
from arch/sparc/kernel/kernel.h:8,
from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/irq_32.c:261:25: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
261 | (unsigned long) &table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two);\
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/sparc/include/uapi/asm/traps.h:27:38: note: in definition of macro 'SPARC_BRANCH'
27 | (0x10800000 | (((dest_addr-inst_addr)>>2)&0x3fffff))
| ^~~~~~~~~
arch/sparc/kernel/irq_32.c:274:3: note: in expansion of macro 'INSTANTIATE'
274 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:144:24: note: while referencing 'trapbase_cpu2'
144 | extern struct tt_entry trapbase_cpu2;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:259:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
259 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two = \
| ^
arch/sparc/kernel/irq_32.c:274:3: note: in expansion of macro 'INSTANTIATE'
274 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:144:24: note: while referencing 'trapbase_cpu2'
144 | extern struct tt_entry trapbase_cpu2;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:262:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
262 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_three = SPARC_RD_WIM_L3; \
| ^
arch/sparc/kernel/irq_32.c:274:3: note: in expansion of macro 'INSTANTIATE'
274 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:144:24: note: while referencing 'trapbase_cpu2'
144 | extern struct tt_entry trapbase_cpu2;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:263:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
263 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP;
| ^
arch/sparc/kernel/irq_32.c:274:3: note: in expansion of macro 'INSTANTIATE'
274 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:144:24: note: while referencing 'trapbase_cpu2'
144 | extern struct tt_entry trapbase_cpu2;
| ^~~~~~~~~~~~~
>> arch/sparc/kernel/irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
258 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_one = SPARC_RD_PSR_L0; \
| ^
arch/sparc/kernel/irq_32.c:276:3: note: in expansion of macro 'INSTANTIATE'
276 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:145:24: note: while referencing 'trapbase_cpu3'
145 | extern struct tt_entry trapbase_cpu3;
| ^~~~~~~~~~~~~
In file included from arch/sparc/include/asm/traps.h:10,
from arch/sparc/kernel/kernel.h:8,
from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/irq_32.c:261:25: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
261 | (unsigned long) &table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two);\
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/sparc/include/uapi/asm/traps.h:27:38: note: in definition of macro 'SPARC_BRANCH'
27 | (0x10800000 | (((dest_addr-inst_addr)>>2)&0x3fffff))
| ^~~~~~~~~
arch/sparc/kernel/irq_32.c:276:3: note: in expansion of macro 'INSTANTIATE'
276 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:145:24: note: while referencing 'trapbase_cpu3'
145 | extern struct tt_entry trapbase_cpu3;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:259:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
259 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two = \
| ^
arch/sparc/kernel/irq_32.c:276:3: note: in expansion of macro 'INSTANTIATE'
276 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:145:24: note: while referencing 'trapbase_cpu3'
145 | extern struct tt_entry trapbase_cpu3;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:262:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
262 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_three = SPARC_RD_WIM_L3; \
| ^
arch/sparc/kernel/irq_32.c:276:3: note: in expansion of macro 'INSTANTIATE'
276 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:145:24: note: while referencing 'trapbase_cpu3'
145 | extern struct tt_entry trapbase_cpu3;
| ^~~~~~~~~~~~~
arch/sparc/kernel/irq_32.c:263:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1]' [-Werror=array-bounds]
263 | table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP;
| ^
arch/sparc/kernel/irq_32.c:276:3: note: in expansion of macro 'INSTANTIATE'
276 | INSTANTIATE(trap_table)
| ^~~~~~~~~~~
In file included from arch/sparc/kernel/irq_32.c:25:
arch/sparc/kernel/kernel.h:145:24: note: while referencing 'trapbase_cpu3'
145 | extern struct tt_entry trapbase_cpu3;
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors


vim +258 arch/sparc/kernel/irq_32.c

^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 240
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 241 int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler)
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 242 {
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 243 unsigned int cpu_irq;
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 244 int err;
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 245
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 246
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 247 err = request_irq(irq, irq_handler, 0, "floppy", NULL);
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 248 if (err)
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 249 return -1;
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 250
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 251 /* Save for later use in floppy interrupt handler */
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 252 floppy_irq = irq;
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 253
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 254 cpu_irq = (irq & (NR_IRQS - 1));
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 255
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 256 /* Dork with trap table if we get this far. */
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 257 #define INSTANTIATE(table) \
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 @258 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_one = SPARC_RD_PSR_L0; \
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 259 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two = \
6baa9b20a68a88 arch/sparc/kernel/irq_32.c Sam Ravnborg 2011-04-18 260 SPARC_BRANCH((unsigned long) floppy_hardint, \
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 261 (unsigned long) &table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two);\
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 262 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_three = SPARC_RD_WIM_L3; \
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 263 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP;
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 264
^1da177e4c3f41 arch/sparc/kernel/irq.c Linus Torvalds 2005-04-16 265 INSTANTIATE(sparc_ttable)
b08b5c9c9b35c9 arch/sparc/kernel/irq_32.c Sam Ravnborg 2012-05-25 266

:::::: The code at line 258 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip