[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3cKMI/vq0wJOrCY@work>
Date: Thu, 17 Nov 2022 22:29:36 -0600
From: "Gustavo A. R. Silva" <gustavoars@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] ipv4/fib: Replace zero-length array with
DECLARE_FLEX_ARRAY() helper
On Thu, Nov 17, 2022 at 08:21:52PM -0800, Kees Cook wrote:
> Zero-length arrays are deprecated[1] and are being replaced with
> flexible array members in support of the ongoing efforts to tighten the
> FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing
> with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3.
>
> Replace zero-length array with flexible-array member in struct key_vector.
>
> This results in no differences in binary output.
>
> [1] https://github.com/KSPP/linux/issues/78
>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>
> Cc: David Ahern <dsahern@...nel.org>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: netdev@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>
Thanks!
--
Gustavo
> ---
> net/ipv4/fib_trie.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index 452ff177e4da..c88bf856c443 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -126,7 +126,7 @@ struct key_vector {
> /* This list pointer if valid if (pos | bits) == 0 (LEAF) */
> struct hlist_head leaf;
> /* This array is valid if (pos | bits) > 0 (TNODE) */
> - struct key_vector __rcu *tnode[0];
> + DECLARE_FLEX_ARRAY(struct key_vector __rcu *, tnode);
> };
> };
>
> --
> 2.34.1
>
Powered by blists - more mailing lists