[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0ea195c3-89cc-1cb5-cdc5-a8bc3927dc99@kernel.org>
Date: Fri, 6 Jan 2023 09:16:05 -0700
From: David Ahern <dsahern@...nel.org>
To: Kees Cook <keescook@...omium.org>,
"David S. Miller" <davem@...emloft.net>
Cc: Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] net: ipv6: rpl_iptunnel: Replace 0-length arrays with
flexible arrays
On 1/5/23 3:15 PM, Kees Cook wrote:
> Zero-length arrays are deprecated[1]. Replace struct ipv6_rpl_sr_hdr's
> "segments" union of 0-length arrays with flexible arrays. Detected with
> GCC 13, using -fstrict-flex-arrays=3:
>
> In function 'rpl_validate_srh',
> inlined from 'rpl_build_state' at ../net/ipv6/rpl_iptunnel.c:96:7:
> ../net/ipv6/rpl_iptunnel.c:60:28: warning: array subscript <unknown> is outside array bounds of 'struct in6_addr[0]' [-Warray-bounds=]
> 60 | if (ipv6_addr_type(&srh->rpl_segaddr[srh->segments_left - 1]) &
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ../include/net/rpl.h:12,
> from ../net/ipv6/rpl_iptunnel.c:13:
> ../include/uapi/linux/rpl.h: In function 'rpl_build_state':
> ../include/uapi/linux/rpl.h:40:33: note: while referencing 'addr'
> 40 | struct in6_addr addr[0];
> | ^~~~
>
> [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
>
> 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: Jakub Kicinski <kuba@...nel.org>
> 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>
> ---
> include/uapi/linux/rpl.h | 4 ++--
> net/ipv6/rpl_iptunnel.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists