Message ID | ZAZ57I6WdQEwWh7v@work |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2147764wrd; Mon, 6 Mar 2023 16:12:58 -0800 (PST) X-Google-Smtp-Source: AK7set+K7exumdavdHCZy8ut5wUsqwz4/1600xU7Qs5F0fse2qzImJrQSu6zeeR9DrC2BLJ90XEt X-Received: by 2002:a17:907:20f8:b0:88e:d435:3fd6 with SMTP id rh24-20020a17090720f800b0088ed4353fd6mr12234668ejb.63.1678147978766; Mon, 06 Mar 2023 16:12:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678147978; cv=none; d=google.com; s=arc-20160816; b=dMNicyNxOxyhBoxOHODjV9DHvge5CdTqVGMvBy55RStoYz2vrz++f2MLZ1h1CyjNl6 PIujgqIfu462FPRi0AE0gXQc1zSOC0CO6rFE9kwgyl608cfq8HdnTRolkbtxBRtXnV3s azAsxkM9fJtQEro8KgoxL1PiwYBYls3HwXd2j7n9isN1lFzWOdTjYfiz5N6gmkfqoIaw 28E51v5mQQoJ4C4wPrlmI67D0gdz636noZUpmEIrmF7VOFNHjVCC9htHQU/D9e5LI0tM GYWRBBNrAy+M/VH6ZdzQ3HE2eaA53WDv0Q/e8xysFRtNKqHJws0WeYVXTIkk54ruTyjx t5sw== 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=1UwTV92ZduwBNDtp/UF6zNiMNZ5qu2gdqQiHFLC4D6Y=; b=eXYSoqVkCICAZgvh8LHdek/GTVPzS/2QvFYiNyBDsoECzuSx+iP9xNz4/Al0d405tB t+5RVK0vjkVBG9RKGlhkkPEK0AmesskTdRqu82zodDE6wY5l1zACTzt2BSl0dvMbgwi9 IaB52Z/wEBdBOtjZM7tgjgYcUtQpQb9BMaNSt6V7U0vgM6nmrENIWzn4NpfJrayhmc/3 Vo7M3cNcOAS27U+TYAoNAs/5nO4VuUS09zm8gIc5/iiP1vY7dNCea90THFZ7aydJ2dD8 7REiYMSxMNuaeEQ4Hww0D/MCZ6QE5Hj50D+n3B0FvQ/Sa8E7CF9FRMX7nvaRPa3lDjdz +hmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SMiGFR90; 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 j3-20020aa7c403000000b004aab3450a00si246663edq.498.2023.03.06.16.12.29; Mon, 06 Mar 2023 16:12:58 -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=SMiGFR90; 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 S229673AbjCFXkG (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Mon, 6 Mar 2023 18:40:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbjCFXkF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Mar 2023 18:40:05 -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 3A0C44B81B; Mon, 6 Mar 2023 15:40:03 -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 C85C660DB9; Mon, 6 Mar 2023 23:40:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B05DAC433EF; Mon, 6 Mar 2023 23:40:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678146002; bh=eCpOTQ0/Lt5qkPZVS4C+58a7vx2Eo4kKSq/QZthxn48=; h=Date:From:To:Cc:Subject:From; b=SMiGFR90uM34CS5CQ4R/loMuIk3job4bqlLvDhnxURYR0lXYfwWEGz37UzqR1EhuQ qalYsLAwRL47RRobA4rVlfu0z7vV4LERyPyoDIsl4431iLAwD2mrx7KghFHtITU3/Y F1dXJ1/D1EoMBZrczbIL2JB7TFrk/auizjC5g97RV572XYPE6JafiwhR2zxSNGLt6N JAPArJGYUzwunWzUIxPGw8sG6FU81FOBSGpyJ2nrOu75m98dbUe2HWnEtKB5ZedO+5 Mqws940ehWrFga9BNoP2JZsE99TFEM/gEGpxoh9e8OgB5gE8BN30euOpHeKbVRm/zm AvCSYtryLHpGg== Date: Mon, 6 Mar 2023 17:40:28 -0600 From: "Gustavo A. R. Silva" <gustavoars@kernel.org> To: Manish Chopra <manishc@marvell.com>, Rahul Verma <rahulv@marvell.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: GR-Linux-NIC-Dev@marvell.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" <gustavoars@kernel.org>, linux-hardening@vger.kernel.org Subject: [PATCH][next] netxen_nic: Replace fake flex-array with flexible-array member Message-ID: <ZAZ57I6WdQEwWh7v@work> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759665694541690799?= X-GMAIL-MSGID: =?utf-8?q?1759665694541690799?= |
Series |
[next] netxen_nic: Replace fake flex-array with flexible-array member
|
|
Commit Message
Gustavo A. R. Silva
March 6, 2023, 11:40 p.m. UTC
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
nx_cardrsp_rx_ctx_t.
Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c:361:26: warning: array subscript <unknown> is outside array bounds of ‘char[0]’ [-Warray-bounds=]
drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c:372:25: warning: array subscript <unknown> is outside array bounds of ‘char[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/265
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/net/ethernet/qlogic/netxen/netxen_nic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Mar 06, 2023 at 05:40:28PM -0600, Gustavo A. R. Silva wrote: > 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 > nx_cardrsp_rx_ctx_t. > > Address the following warnings found with GCC-13 and > -fstrict-flex-arrays=3 enabled: > drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c:361:26: warning: array subscript <unknown> is outside array bounds of ‘char[0]’ [-Warray-bounds=] > drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c:372:25: warning: array subscript <unknown> is outside array bounds of ‘char[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/265 > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Simon Horman <simon.horman@corigine.com>
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h index f13fa7396aef..3d36d23df0c6 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h @@ -854,7 +854,7 @@ typedef struct { The following is packed: - N cardrsp_rds_rings - N cardrs_sds_rings */ - char data[0]; + char data[]; } nx_cardrsp_rx_ctx_t; #define SIZEOF_HOSTRQ_RX(HOSTRQ_RX, rds_rings, sds_rings) \