rxrpc: Replace fake flex-array with flexible-array member
Subsystems (3)
PATCH 1/1 rxrpc: Replace fake flex-array with flexible-array member
Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.
Transform zero-length array into flexible-array member in struct rxrpc_ackpacket.
Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:net/rxrpc/call_event.c:149:38: warning: array subscript i is outside array bounds of ‘uint8_t[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].
--- net/rxrpc/protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/protocol.h +1 -1
@@ -126,7 +126,7 @@ struct rxrpc_ackpacket {uint8_t nAcks;/* number of ACKs */ #define RXRPC_MAXACKS 255 -uint8_t acks[0 ];/* list of ACK/NAKs */ +uint8_t acks[];/* list of ACK/NAKs */ #define RXRPC_ACK_TYPE_NACK 0#define RXRPC_ACK_TYPE_ACK 1
Signature · 1 line
2.34.1
Quoted 10 lines · Gustavo A. R. Silva
Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.
Transform zero-length array into flexible-array member in struct
rxrpc_ackpacket.Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:net/rxrpc/call_event.c:149:38: warning: array subscript i is outside array bounds of ‘uint8_t[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
Quoted 8 lines
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].
Quoted 10 lines · Gustavo A. R. Silva
Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.
Transform zero-length array into flexible-array member in struct
rxrpc_ackpacket.Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:net/rxrpc/call_event.c:149:38: warning: array subscript i is outside array bounds of ‘uint8_t[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]
Quoted 8 lines
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].
Signature · 1 line
Kees Cook
Hi all,
Friendly ping: who can take this, please? 😄
Thanks
Signature · 1 line
Gustavo
Quoted 35 lines · Gustavo A. R. Silva
Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.
Transform zero-length array into flexible-array member in struct
rxrpc_ackpacket.Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:net/rxrpc/call_event.c:149:38: warning: array subscript i is outside array bounds of ‘uint8_t[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].Signed-off-by Gustavo A. R. Silva <[email protected]>--- net/rxrpc/protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/rxrpc/protocol.h +1
-1@@ -126,7 +126,7 @@ struct rxrpc_ackpacket {uint8_t nAcks;/* number of ACKs */ #define RXRPC_MAXACKS 255 -uint8_t acks[0 ];/* list of ACK/NAKs */ +uint8_t acks[];/* list of ACK/NAKs */ #define RXRPC_ACK_TYPE_NACK 0#define RXRPC_ACK_TYPE_ACK 1
Quoted 27 lines · Gustavo A. R. Silva
Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.
Transform zero-length array into flexible-array member in struct
rxrpc_ackpacket.Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:net/rxrpc/call_event.c:149:38: warning: array subscript i is outside array bounds of ‘uint8_t[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].Signed-off-by Gustavo A. R. Silva <[email protected]>--- net/rxrpc/protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/rxrpc/protocol.h +0
-0
net/rxrpc/protocol.h struct rxrpc_ackpacket { · line 132
Quoted 8 lines
net/rxrpc/protocol.h +1
-1@@ -126,7 +126,7 @@ struct rxrpc_ackpacket {uint8_t nAcks;/* number of ACKs */ #define RXRPC_MAXACKS 255 -uint8_t acks[0 ];/* list of ACK/NAKs */ +uint8_t acks[];/* list of ACK/NAKs */ #define RXRPC_ACK_TYPE_NACK 0#define RXRPC_ACK_TYPE_ACK 1