KSPP / linux

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

Replace fake flexible array with C99 flexible-array member in drivers/net/ethernet/qlogic/netxen/netxen_nic.h #265

Closed GustavoARSilva closed 1 year ago

GustavoARSilva commented 1 year ago
 841 typedef struct {
 842         /* These ring offsets are relative to data[0] below */
 843         __le32 rds_ring_offset; /* Offset to RDS config */
 844         __le32 sds_ring_offset; /* Offset to SDS config */
...
 852         u8  reserved[128];      /* save space for future expansion */
 853         /*  MUST BE 64-bit aligned.
 854            The following is packed:
 855            - N cardrsp_rds_rings
 856            - N cardrs_sds_rings */
 857         char data[0];
 858 } nx_cardrsp_rx_ctx_t;

-Warray-bounds warnings with GCC-13 and -fstrict-flex-arrays=3:

drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c:361:26: warning: array subscript <unknown> is outside array bounds of ‘char[0]’ [-Warray-bounds=]
drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c:372:25: warning: array subscript <unknown> is outside array bounds of ‘char[0]’ [-Warray-bounds=]
GustavoARSilva commented 1 year ago

Patch: https://lore.kernel.org/linux-hardening/ZAZ57I6WdQEwWh7v@work/