]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rxrpc: Replace fake flex-array with flexible-array member
authorGustavo A. R. Silva <gustavoars@kernel.org>
Fri, 21 Apr 2023 13:08:53 +0000 (14:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 23 Apr 2023 12:36:05 +0000 (13:36 +0100)
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].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/263
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
cc: linux-hardening@vger.kernel.org
Link: https://lore.kernel.org/r/ZAZT11n4q5bBttW0@work/
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rxrpc/protocol.h

index 6760cb99c6d61a78d26170344ebcfa037b3837c2..e8ee4af43ca89b4b5d00f42baf5b3c5642b9c4b0 100644 (file)
@@ -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