habanalabs: Replace zero-length arrays with flexible-array members
PATCH 1/1 habanalabs: Replace zero-length arrays with flexible-array members
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays in a couple of structures with flex-array members.
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 [2].
--- drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h +2 -2
@@ -59,7 +59,7 @@ struct gaudi2_packet {/* The rest of the packet data follows. Use the corresponding * packet_XXX struct to deference the data, based on packet type */ -u8 contents[0 ]; +u8 contents[]; };struct packet_nop {
@@ -80,7 +80,7 @@ struct packet_wreg32 {struct packet_wreg_bulk {__le32 size64;__le32 ctl; -__le64 values[0 ];/* data starts here */ +__le64 values[];/* data starts here */ };struct packet_msg_long {
Signature · 1 line
2.34.1
Quoted 4 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays in a couple of structures with flex-array members.
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 [2].
Oded Gabbay
maintainerQuoted 10 lines · Stanislaw Gruszka
Quoted 8 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays in a couple of structures with flex-array members.
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2].
Quoted 6 lines
Quoted 4 lines
Reviewed-by Stanislaw Gruszka <[email protected]>
Thanks,
applied to -next.
Oded