From patchwork Mon Sep 26 23:02:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 12989523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 651A6C07E9D for ; Mon, 26 Sep 2022 23:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbiIZXCa (ORCPT ); Mon, 26 Sep 2022 19:02:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbiIZXC3 (ORCPT ); Mon, 26 Sep 2022 19:02:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DBD3A6C32; Mon, 26 Sep 2022 16:02:28 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id B4848B815A2; Mon, 26 Sep 2022 23:02:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBD04C433C1; Mon, 26 Sep 2022 23:02:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664233345; bh=5dChttAHV31mKU5I2NgaQQKiJXkhkhhDNgOij7T3c9Y=; h=Date:From:To:Cc:Subject:From; b=MR1D7pcp2gGikSxBXu28M3Ea1TFbxRqrIFnKiG843hTEk9Yy0ZGZ7KYMIaIz1U74V Z+KgP2tppCHkHY3kq1FtEFQoMlBCPN7JJj5tVsma2AVhdi1qSZ33yodiwri+mSrBrg RGD8w9NZ6e6MyN03WrII8BmS1wn2p+6TFP6jJYyCfrJRrIg2GAqpQBNkN05G3r6QxD WpweY2+iRKuGnAG5pA69CbPlXnd/bD85uMBaH8lj/mhWrmQvtr+vY3ZKmyIysAh9VB D4jBQm+eHUtSrJJD1kUuXi+J6Gek0E0vaZh10N7se7UvDRMDwyKPzecL6ZH34tTeXT uRw97VLopjl6g== Date: Mon, 26 Sep 2022 18:02:20 -0500 From: "Gustavo A. R. Silva" To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] netns: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for flexible-array members in unions. Link: https://github.com/KSPP/linux/issues/193 Link: https://github.com/KSPP/linux/issues/225 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- include/net/netns/generic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h index 7ce68183f6e1..00c399edeed1 100644 --- a/include/net/netns/generic.h +++ b/include/net/netns/generic.h @@ -33,7 +33,7 @@ struct net_generic { struct rcu_head rcu; } s; - void *ptr[0]; + DECLARE_FLEX_ARRAY(void *, ptr); }; };