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 include/uapi/linux/wireless.h #261

Closed GustavoARSilva closed 1 year ago

GustavoARSilva commented 1 year ago
 829 struct iw_encode_ext {
 830         __u32           ext_flags; /* IW_ENCODE_EXT_* */
 831         __u8            tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
 832         __u8            rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
 833         struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
 834                                * (group) keys or unicast address for
 835                                * individual keys */
 836         __u16           alg; /* IW_ENCODE_ALG_* */
 837         __u16           key_len;
 838         __u8            key[0];
 839 };

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

drivers/staging/ks7010/ks_wlan_net.c:1597:50: warning: array subscript 0 is outside array bounds of ‘__u8[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
drivers/staging/ks7010/ks_wlan_net.c:1603:61: warning: array subscript 16 is outside array bounds of ‘__u8[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
drivers/staging/ks7010/ks_wlan_net.c:1604:61: warning: array subscript 24 is outside array bounds of ‘__u8[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
drivers/staging/ks7010/ks_wlan_net.c:1600:61: warning: array subscript 16 is outside array bounds of ‘__u8[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
drivers/staging/ks7010/ks_wlan_net.c:1586:50: warning: array subscript 0 is outside array bounds of ‘__u8[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
GustavoARSilva commented 1 year ago

https://lore.kernel.org/linux-hardening/20220216195306.GA904220@embeddedor/