linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member
@ 2023-03-06 20:57 Gustavo A. R. Silva
  2023-03-07 15:46 ` Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2023-03-06 20:57 UTC (permalink / raw)
  To: David Howells, Marc Dionne, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-afs, netdev, linux-kernel, Gustavo A. R. Silva,
	linux-hardening

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 [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 net/rxrpc/protocol.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rxrpc/protocol.h b/net/rxrpc/protocol.h
index 6760cb99c6d6..e8ee4af43ca8 100644
--- a/net/rxrpc/protocol.h
+++ b/net/rxrpc/protocol.h
@@ -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
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member
  2023-03-06 20:57 [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member Gustavo A. R. Silva
@ 2023-03-07 15:46 ` Simon Horman
  2023-03-20 17:39 ` Kees Cook
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-03-07 15:46 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: David Howells, Marc Dionne, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-afs, netdev, linux-kernel,
	linux-hardening

On Mon, Mar 06, 2023 at 02:57:59PM -0600, Gustavo A. R. Silva wrote:
> 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 [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member
  2023-03-06 20:57 [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member Gustavo A. R. Silva
  2023-03-07 15:46 ` Simon Horman
@ 2023-03-20 17:39 ` Kees Cook
  2023-03-30 20:15 ` Gustavo A. R. Silva
  2023-04-21 13:00 ` Jeffrey E Altman
  3 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2023-03-20 17:39 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: David Howells, Marc Dionne, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-afs, netdev, linux-kernel,
	linux-hardening

On Mon, Mar 06, 2023 at 02:57:59PM -0600, Gustavo A. R. Silva wrote:
> 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 [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member
  2023-03-06 20:57 [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member Gustavo A. R. Silva
  2023-03-07 15:46 ` Simon Horman
  2023-03-20 17:39 ` Kees Cook
@ 2023-03-30 20:15 ` Gustavo A. R. Silva
  2023-04-21 13:00 ` Jeffrey E Altman
  3 siblings, 0 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2023-03-30 20:15 UTC (permalink / raw)
  To: Gustavo A. R. Silva, David Howells, Marc Dionne, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-afs, netdev, linux-kernel, linux-hardening

Hi all,

Friendly ping: who can take this, please? 😄

Thanks
-- 
Gustavo

On 3/6/23 14:57, Gustavo A. R. Silva wrote:
> 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 [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>   net/rxrpc/protocol.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/rxrpc/protocol.h b/net/rxrpc/protocol.h
> index 6760cb99c6d6..e8ee4af43ca8 100644
> --- a/net/rxrpc/protocol.h
> +++ b/net/rxrpc/protocol.h
> @@ -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
>   

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member
  2023-03-06 20:57 [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member Gustavo A. R. Silva
                   ` (2 preceding siblings ...)
  2023-03-30 20:15 ` Gustavo A. R. Silva
@ 2023-04-21 13:00 ` Jeffrey E Altman
  3 siblings, 0 replies; 5+ messages in thread
From: Jeffrey E Altman @ 2023-04-21 13:00 UTC (permalink / raw)
  To: Gustavo A. R. Silva (gustavoars@kernel.org), David Howells,
	Marc Dionne, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: linux-afs, netdev, linux-kernel, linux-hardening

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

On 3/6/2023 3:57 PM, Gustavo A. R. Silva (gustavoars@kernel.org) wrote:
> 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 [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>   net/rxrpc/protocol.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/rxrpc/protocol.h b/net/rxrpc/protocol.h
> index 6760cb99c6d6..e8ee4af43ca8 100644
> --- a/net/rxrpc/protocol.h
> +++ b/net/rxrpc/protocol.h
> @@ -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
>   

Reviewed-by: Jeffrey Altman <jaltman@auristor.com>



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4039 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-21 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-06 20:57 [PATCH][next] rxrpc: Replace fake flex-array with flexible-array member Gustavo A. R. Silva
2023-03-07 15:46 ` Simon Horman
2023-03-20 17:39 ` Kees Cook
2023-03-30 20:15 ` Gustavo A. R. Silva
2023-04-21 13:00 ` Jeffrey E Altman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).