From patchwork Mon Mar 6 23:51:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 65184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2149680wrd; Mon, 6 Mar 2023 16:16:45 -0800 (PST) X-Google-Smtp-Source: AK7set9dp67M+vyQlTKqgksUkz8cFcW5PeZWnwTgV4Fwhh+al6vTymO94q/E5WpcaEvgVcUhmTnP X-Received: by 2002:a17:907:6091:b0:8b1:7de0:c854 with SMTP id ht17-20020a170907609100b008b17de0c854mr16441653ejc.41.1678148205756; Mon, 06 Mar 2023 16:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678148205; cv=none; d=google.com; s=arc-20160816; b=Eh/0SgvpBKcQOnTDc3XvOnEGumEEHFGyvzOWFb3WBMoSPz36SoJSZ6vp4qVZnYIzAi mH7C+Q9O/Xj4xYEVbYY63kAOTC3morSJK8LQ+FOh9HgQ9W4vXTFsLY73SQvkQJrPSQ+5 TNHzJJRFr/GbiL1Xt0Uw3kArt2VmgwkivvA1ZqAct0NvZGnfGgN2KnJ/8/V+rBqQ2s/l TpuPD6x3EeAJEMKqjTmgsn3us++KVS5/LmAcFJrQmxzgqbiOUdFOC2nXoH2OErqiJAhv 1GPoVLq2AhofJg/x8vqgq6iku/Ra/Ft8sjqyhV1zd1YEKMw9oSgct+jb60gG/DbjG828 NGtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=nfhnk/KTqmGt5aaGfSTyHsRhLMA7A2gEuNNIttRuHjs=; b=hzh6onMgk4k7IvFc2rTkWlbmzoPRHGxcX7COk3YtZajDH5sQw1PdIdswsZD4S1zkOL jpV1TToiOZGzAjbwnTlC3fwTg+DLvqcVYnSbqLwEzSOaM7aMNH5rH5NCdZ6Klrz7okMx 2/CwpBV9pIzwPslTKOLF3Zx0Jt+kb/kwIgA1gCBhspOVOP4M7VuaQP3CK4k4Ktxwpxew LPnrjm+T2rNUqMTZKwelJnEhncQ6XSMjs1uRdXWjXhrxC9V8Hk7+yurCtgLGOjWVqvxz 5uBC5N3C31+zXhOfekFJWAL2LFWnW4OSsB1go5yzMJHC/fS4bBNIAhw+zaePX+w7tqIG wYGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TU1Ruuek; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb4-20020a170907070400b008d17b125784si14542076ejb.30.2023.03.06.16.16.22; Mon, 06 Mar 2023 16:16:45 -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=TU1Ruuek; 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 S229611AbjCFXvb (ORCPT + 99 others); Mon, 6 Mar 2023 18:51:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjCFXv3 (ORCPT ); Mon, 6 Mar 2023 18:51:29 -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 00A2E3B3E3; Mon, 6 Mar 2023 15:51:27 -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 AAE5BB80E98; Mon, 6 Mar 2023 23:51:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11C78C433EF; Mon, 6 Mar 2023 23:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678146685; bh=jL7xXOOyjDrI1lWEUBmIuKIMDYmR+aYVz30Qx6CwOT0=; h=Date:From:To:Cc:Subject:From; b=TU1RuuekTGlXlz65IZhKSq04p671+b9C3B6TVcUVnowY4mlVDgUE2HJTkNrBj6AJ9 sVOuwDE8Lx9oeU2Sd+WlOvfB6lAho86dFhJLVoLLa1n4TA3eLk/v4b37tj+2iimWIr bLvDMil1xwUhHsg+77M/MeOoWUAUwp4F+ucIn4ZU055VR/ay7ko9rpwIf4S0AUJaLu 4kK3mN+V1NG+eG3UwU4EKt/tere4MUnd0ymUTzmwcTLtoVd0Q7gupKXSoUkYDBqy2C LXB316/9x7OldO2mkCFqs4n08ekxtUXmUGZRFQxqa3tF+RWZDQa5J5tb6jUbdFdLDk U7VjVDlQKCV7Q== Date: Mon, 6 Mar 2023 17:51:52 -0600 From: "Gustavo A. R. Silva" To: Tariq Toukan , "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/mlx4_en: Replace fake flex-array with flexible-array member Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759665933075127027?= X-GMAIL-MSGID: =?utf-8?q?1759665933075127027?= Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead. Transform zero-length array into flexible-array member in struct mlx4_en_rx_desc. Address the following warnings found with GCC-13 and -fstrict-flex-arrays=3 enabled: drivers/net/ethernet/mellanox/mlx4/en_rx.c:88:30: warning: array subscript i is outside array bounds of ‘struct mlx4_wqe_data_seg[0]’ [-Warray-bounds=] drivers/net/ethernet/mellanox/mlx4/en_rx.c:149:30: warning: array subscript 0 is outside array bounds of ‘struct mlx4_wqe_data_seg[0]’ [-Warray-bounds=] drivers/net/ethernet/mellanox/mlx4/en_rx.c:127:30: warning: array subscript i is outside array bounds of ‘struct mlx4_wqe_data_seg[0]’ [-Warray-bounds=] drivers/net/ethernet/mellanox/mlx4/en_rx.c:128:30: warning: array subscript i is outside array bounds of ‘struct mlx4_wqe_data_seg[0]’ [-Warray-bounds=] drivers/net/ethernet/mellanox/mlx4/en_rx.c:129:30: warning: array subscript i is outside array bounds of ‘struct mlx4_wqe_data_seg[0]’ [-Warray-bounds=] drivers/net/ethernet/mellanox/mlx4/en_rx.c:117:30: warning: array subscript i is outside array bounds of ‘struct mlx4_wqe_data_seg[0]’ [-Warray-bounds=] drivers/net/ethernet/mellanox/mlx4/en_rx.c:119:30: warning: array subscript i is outside array bounds of ‘struct mlx4_wqe_data_seg[0]’ [-Warray-bounds=] This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1]. Link: https://github.com/KSPP/linux/issues/21 Link: https://github.com/KSPP/linux/issues/264 Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] Signed-off-by: Gustavo A. R. Silva Reviewed-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 544e09b97483..034733b13b1a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h @@ -323,7 +323,7 @@ struct mlx4_en_tx_ring { struct mlx4_en_rx_desc { /* actual number of entries depends on rx ring stride */ - struct mlx4_wqe_data_seg data[0]; + DECLARE_FLEX_ARRAY(struct mlx4_wqe_data_seg, data); }; struct mlx4_en_rx_ring {