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 net/rxrpc/protocol.h #263

Closed GustavoARSilva closed 1 year ago

GustavoARSilva commented 1 year ago
106 struct rxrpc_ackpacket {
107         __be16          bufferSpace;    /* number of packet buffers available */
108         __be16          maxSkew;        /* diff between serno being ACK'd and highest serial no
...
129         uint8_t         acks[0];        /* list of ACK/NAKs */
130 #define RXRPC_ACK_TYPE_NACK             0
131 #define RXRPC_ACK_TYPE_ACK              1
132 
133 } __packed;

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

net/rxrpc/call_event.c:149:38: warning: array subscript i is outside array bounds of ‘uint8_t[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
GustavoARSilva commented 1 year ago

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