From patchwork Wed Jan 11 05:30:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13096070 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 A14C0C46467 for ; Wed, 11 Jan 2023 05:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbjAKFjE (ORCPT ); Wed, 11 Jan 2023 00:39:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbjAKFiY (ORCPT ); Wed, 11 Jan 2023 00:38:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C55B110D6; Tue, 10 Jan 2023 21:31:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7E73DB819CA; Wed, 11 Jan 2023 05:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CC2FC433D2; Wed, 11 Jan 2023 05:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673415062; bh=PNeIzQ0BnCCovzN26qdzCCU+T0YlKNW4vpIvPE3ZHSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SV9Se2yvGJJbFyAm5bX/oXyPlKZNWcETVgK1zz2U1W8FRiy+YBTnbSEhbS5XABTt7 EbTTeF41N2p07sNIzQZmmv/jXzXyM62/PmLHJh7scz2RznV2tFKcfTqWyDOOP2CRGy z360IWf5Pus4cxkH/rYIhd/D/hQ+BCFyt5I+QWsmHqDM7qiP98LhXaiNv28G1lH/iG ZDCupRW2IgnxaeSPAcVPnanOFA8xc9GaEfhc4MrM9cs8vUNWL4MNK1jQjJUEappysT wKjNa5EqxHmtWv97WLEoH/+j/yC6UsMeCF+qdMWLT9Sj9/RzBoDxy9BTmVjbA7oJm4 PRmf3eokfnfeA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Kees Cook , Leon Romanovsky , "Gustavo A. R. Silva" , linux-rdma@vger.kernel.org, Jiri Pirko Subject: [net-next 13/15] net/mlx5e: Replace 0-length array with flexible array Date: Tue, 10 Jan 2023 21:30:43 -0800 Message-Id: <20230111053045.413133-14-saeed@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111053045.413133-1-saeed@kernel.org> References: <20230111053045.413133-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kees Cook Zero-length arrays are deprecated[1]. Replace struct mlx5e_rx_wqe_cyc's "data" 0-length array with a flexible array. Detected with GCC 13, using -fstrict-flex-arrays=3: drivers/net/ethernet/mellanox/mlx5/core/en_main.c: In function 'mlx5e_alloc_rq': drivers/net/ethernet/mellanox/mlx5/core/en_main.c:827:42: warning: array subscript f is outside array bounds of 'struct mlx5_wqe_data_seg[0]' [-Warray-bounds=] 827 | wqe->data[f].byte_count = 0; | ~~~~~~~~~^~~ In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h:11, from drivers/net/ethernet/mellanox/mlx5/core/eswitch.h:48, from drivers/net/ethernet/mellanox/mlx5/core/en_main.c:42: drivers/net/ethernet/mellanox/mlx5/core/en.h:250:39: note: while referencing 'data' 250 | struct mlx5_wqe_data_seg data[0]; | ^~~~ [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays Cc: Saeed Mahameed Cc: Leon Romanovsky Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: "Gustavo A. R. Silva" Cc: netdev@vger.kernel.org Cc: linux-rdma@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Reviewed-by: Jiri Pirko Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 7cbd71f0b8ae..82573ac722d1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -247,7 +247,7 @@ struct mlx5e_rx_wqe_ll { }; struct mlx5e_rx_wqe_cyc { - struct mlx5_wqe_data_seg data[0]; + DECLARE_FLEX_ARRAY(struct mlx5_wqe_data_seg, data); }; struct mlx5e_umr_wqe {