KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
82 stars 5 forks source link

Address -Warray-bounds warning in drivers/net/ethernet/i825xx/sun3_82586.c #325

Closed GustavoARSilva closed 1 week ago

GustavoARSilva commented 1 year ago

Found after building m68k with sun3_defconfig:

drivers/net/ethernet/i825xx/sun3_82586.c: In function 'sun3_82586_timeout':
  CC [M]  net/ipv4/netfilter/iptable_mangle.o
drivers/net/ethernet/i825xx/sun3_82586.c:990:122: warning: array subscript 1 is above array bounds of 'volatile struct transmit_cmd_struct *[1]' [-Warray-bounds=]
  990 |                 printk("%s: command-stats: %04x %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status));
      |                                                                                                              ~~~~~~~~~~~~^~~
include/uapi/linux/swab.h:107:19: note: in definition of macro '__swab16'
  107 |         __fswab16(x))
      |                   ^
include/linux/printk.h:455:26: note: in expansion of macro 'printk_index_wrap'
  455 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~~~
drivers/net/ethernet/i825xx/sun3_82586.c:990:17: note: in expansion of macro 'printk'
  990 |                 printk("%s: command-stats: %04x %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status));
      |                 ^~~~~~
  CC [M]  net/appletalk/ddp.o
drivers/net/ethernet/i825xx/sun3_82586.c:156:46: note: while referencing 'xmit_cmds'
  156 |         volatile struct transmit_cmd_struct *xmit_cmds[NUM_XMIT_BUFFS];
kees commented 8 months ago

Sent a fix: https://lore.kernel.org/lkml/20240206161651.work.876-kees@kernel.org

kees commented 1 week ago

commit 4bea747f3fbec33c16d369b2f51e55981d7c78d0