From patchwork Mon Sep 26 21:50:42 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: 12989454 X-Patchwork-Delegate: kuba@kernel.org 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 21A3DC6FA82 for ; Mon, 26 Sep 2022 21:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230227AbiIZVux (ORCPT ); Mon, 26 Sep 2022 17:50:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbiIZVuw (ORCPT ); Mon, 26 Sep 2022 17:50:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80838B14E7; Mon, 26 Sep 2022 14:50:51 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D30986134E; Mon, 26 Sep 2022 21:50:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4C30C433D6; Mon, 26 Sep 2022 21:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664229049; bh=wjVBM2rtaXLU9XIzfLnEkRHuZJyfInxhvNz/xCYz1NU=; h=Date:From:To:Cc:Subject:From; b=RlLDMnwX600IDLVy4DKLv+JQ3x8lUPQHI0OVDGSIvtVJObTkGDWVflfS6Hyt0XcY6 IH1ZpuIzvaKogZty98eGLQV9M0qyQ806nQimmSI6aqCPGJ6COh3uQMYjgkdZLtaPMc c/sZnjriBgFCn8jxYXHNGE9OpQPgkMoDbF229eMK9vs/z+PWgdDA6ZUqf+8vwh+2IH Nq5Aq6GbevgyjEKiI6MuSblMnpF8aiR5Jki5BSk3Daqb07ODS8qWqN6sBjI5jsDHY5 GdGgkXcRDrAilJwo32A4dlcbe/4Qg81P8Qxh1hTWUA4je1Rw6JSQX22qDhBhhAvehO KfUkh0akqf9Cg== Date: Mon, 26 Sep 2022 16:50:42 -0500 From: "Gustavo A. R. Silva" To: Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] net/mlx5e: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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/222 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h index 48241317a535..0db41fa4a9a6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h @@ -97,8 +97,8 @@ struct mlx5_flow_attr { } lag; /* keep this union last */ union { - struct mlx5_esw_flow_attr esw_attr[0]; - struct mlx5_nic_flow_attr nic_attr[0]; + DECLARE_FLEX_ARRAY(struct mlx5_esw_flow_attr, esw_attr); + DECLARE_FLEX_ARRAY(struct mlx5_nic_flow_attr, nic_attr); }; };