Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp90089rwb; Thu, 17 Nov 2022 21:12:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf5g//kA6ufitgkmp7QMAhYapDvBy4NEz7zMIXlOaM2Hk6F/RqYtFWKFl0zXiDJU04bwuznm X-Received: by 2002:a05:6402:4445:b0:468:eef6:a83c with SMTP id o5-20020a056402444500b00468eef6a83cmr4014779edb.191.1668748370561; Thu, 17 Nov 2022 21:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668748370; cv=none; d=google.com; s=arc-20160816; b=Ltxjko4nqF8HIun3mw7tY6yWOmBx42/MzQIWDtvjOQey2JN8TcoLpi3OF35lkvxx9L qhdT2XJMqMS3HXNSwSQjkcB6ThDZbGe27ZPW4CwLAiwa/suOo1EfYD+/H22OMbcj8G9z xc329HbNHZQ8K/iv4eXe76FhPwISFBx+zLCcITIuB+NDQh8UbEpEWSBKKXl14MZQC5LU C3pPorHqwysipP2A+9PV2m7uVJ2CIBE87Lu38muWtssC8bOETjgMytdVLdU0jKedAgDm Vfoh8i0uvY6Br6loEtMEa/DIzD+1QO//deBk4NGvBsU1Bjoh4+Gr0UIM0nD7Pj50t7Ys D7Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Mnp06SxIGCnOJdG6xBC2fgqCgvZ5b8Mi+FUPRb8Oyy8=; b=CtX2mQu2/qD1AZDuXlWWLbiJtQxRF559N0rd4zUuqr10tcNMYD/acXUdsHrleuU4iT Eyri9vpJ4F1f7Ko4z3xQRUevAL6m9Yp5aRcxjn3nCdiOjsAp/xsHUaHXu3oOFBu/1ru0 gsCRtd0h3NERwWTk0PRBMK7w0mrPyHJjuNcGLKkMgZWV8Fq/6j7hYS4jlC1xd7RKZUuU MhnwB8ugx+qp2wAKOPR4tJa6YV0ik9jUF0Z5rAKXTP5NFT/CmucF1nUg0K5TVR7+Y5B0 5r0qEYpZHWPlhF/GH02LLzqejjMUzL0ziJuS4LbkgXUFtH1+cQAPobIMVKDYa3bQ9vBt 2SiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MUl75vX/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xh13-20020a170906da8d00b007a6384d506csi2340702ejb.643.2022.11.17.21.12.02; Thu, 17 Nov 2022 21:12:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MUl75vX/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235063AbiKRE34 (ORCPT + 91 others); Thu, 17 Nov 2022 23:29:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235016AbiKRE3x (ORCPT ); Thu, 17 Nov 2022 23:29:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B99A1ADAE; Thu, 17 Nov 2022 20:29:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 81FE962308; Fri, 18 Nov 2022 04:29:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3E46C433C1; Fri, 18 Nov 2022 04:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668745790; bh=mOMFpTq0wEGsUBY3eHX7t2CuNkWSUb9x9HDIWPh/G68=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MUl75vX/jZrj9JXskHpLcLDqZjQ7XejdiKXXWoLT/OLQRRG18NsuRhhQpGyk+P7Vl sIVJf6Hp48eLdHrDx6OG7MNjISteFtYAzxi0zA+9VigXLqWMaWiVHzX5mlA69ZqmFm n2/SYvmszW9/FTDZm+or5iFKV6SBzBuSLyMtg0ZsYzgsBdXw83UUHUI8bzYFi5wV3A DQmNoIr964Ot6BUGE9/OlyBVwklMBcjnrDGvwFhuE6Vm8AE35md1ta0H1UwNcTL/7P k+jWEOyzKXlfzbAkZ1IGiqXu6sbAUw8vH3NEO3CX9xMpSRdwZ1F2B0v/kTqMcA22NK O4j1OZDTd/8jQ== Date: Thu, 17 Nov 2022 22:29:36 -0600 From: "Gustavo A. R. Silva" To: Kees Cook Cc: Jakub Kicinski , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] ipv4/fib: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Message-ID: References: <20221118042142.never.400-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221118042142.never.400-kees@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: "David S. Miller" > Cc: Hideaki YOSHIFUJI > Cc: David Ahern > Cc: Eric Dumazet > Cc: Paolo Abeni > Cc: "Gustavo A. R. Silva" > Cc: netdev@vger.kernel.org > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva 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 >