Message ID | Y7zB7shx/u1zWrbj@work |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2487950wrt; Mon, 9 Jan 2023 17:41:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXvjgGVIxvNuyiKPCWjgHr+HpmC5Ovltyx1i2/30XOL+n7rwHumZ/QLZBTnycv6s/l4jNfSJ X-Received: by 2002:a17:902:eb8a:b0:192:9dc5:54b6 with SMTP id q10-20020a170902eb8a00b001929dc554b6mr46308621plg.48.1673314886390; Mon, 09 Jan 2023 17:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673314886; cv=none; d=google.com; s=arc-20160816; b=s2vsm6VwDCkX0TL5Kal59+bkAvDF+Bgys28Mrfly8w/sVEmedYLXwIA9kfH2NGTWER 7qSDYhg0xrRGo6gsROrCjEXktUpy+4b4KWw7zFUAYizzfbz5qGhgnnixiPpxB6DPiWKr Y5AF2Svs9A8ZeP4/0ZKFpjE3lXrcD5uRubjv/MFQj64oAW8BuLfkA0QzUpki3GnX+Ycc kFGDZ6FG5DQjBfNWcx1QfB/myU0KkQQr7qEkxcQBbo1mmbmGbZ9wIfYe+9cJueNJD1W6 co03L9i5t3yxQ10r6/eavlMK+M/ZE6I2tdbBv4lauxJa1ZjTHn2HnrABtTGBveMpHMlW O5EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=CRH1xGpziAn+8huRg9S9MYAM5WJpbJEVHtyM9327rkI=; b=ZxvuVOZITQPUaXRxeBfNesiYf9syhkuiTnN/82NbC9mhIXhl/aveckZ2ah2yg9j/Nr JGP92DyVsKHpraPTXqgP3n86YxdFCzREsd5tXmvmPpPN+wZSH0ehojCZsWVgclusZmZx Toa+qcUpizF36Pv1oO9sbbFZp+FbwI6ywPQiZtbFVXuZvaOI5bpQlXQkmV8cn3FQvTb+ AxYjpHSZyZ346KEvtGYy+auIkEknADEc8SLTAFwBOVC4N95XwflKcpUbeZ+qrQYUKEW0 oId7sIkSaUzFvanwOPnCPdtNuwtX8kN6nChzUHbnPLhBlbx9U/UkcGQwK0pYhaw5veT/ xvBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="iZ/+XZPz"; 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 m9-20020a170902db0900b0017f59ed2dfasi10881204plx.63.2023.01.09.17.41.14; Mon, 09 Jan 2023 17:41:26 -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="iZ/+XZPz"; 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 S229940AbjAJBj6 (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Mon, 9 Jan 2023 20:39:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234778AbjAJBjz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 9 Jan 2023 20:39:55 -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 4ED802027; Mon, 9 Jan 2023 17:39:54 -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 106A0B810B3; Tue, 10 Jan 2023 01:39:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A57BC433D2; Tue, 10 Jan 2023 01:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673314791; bh=l4l5PaltAVow68iJO8Oi3TAG2+KxK22xrLBw7Tx9pFQ=; h=Date:From:To:Cc:Subject:From; b=iZ/+XZPz9dbjlyKU/lhTX44SKa3NKJowaGZPW9gcnKeu+8R9Qk9yL9wxOZnB5fEM0 DW2kNwby1+c3ZTUQ4tSJLMA6fF/Frsou/ZFyxjUAptJ2remRoUSWyGb8sm08kULwer I+e8k+riaNY5+QOFtKC+uk6SGNoiJecO4ombiEEfGIWyBQcdV4wbibsiA7kVKg0mlf VmefWTOFg4HALaYzpIOMjLdwW/FNJifSAfpV9PFK/isJIl+PDIV4IaqXPt4l7lN02Q gTCLPGr8lX9Iv8ngVbaS/kSkQS9B7GKEBaJL8IdciFu4gAJDGxpClZhLQQOE6bVOl0 2UjhPKDfWc7SQ== Date: Mon, 9 Jan 2023 19:39:58 -0600 From: "Gustavo A. R. Silva" <gustavoars@kernel.org> To: Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leon@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" <gustavoars@kernel.org>, linux-hardening@vger.kernel.org Subject: [PATCH][next] net/mlx5e: Replace zero-length array with flexible-array member Message-ID: <Y7zB7shx/u1zWrbj@work> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1754597830183999255?= X-GMAIL-MSGID: =?utf-8?q?1754597830183999255?= |
Series |
[next] net/mlx5e: Replace zero-length array with flexible-array member
|
|
Commit Message
Gustavo A. R. Silva
Jan. 10, 2023, 1:39 a.m. UTC
Zero-length arrays are deprecated[1] and we are moving towards
adopting C99 flexible-array members instead. So, replace zero-length
array declaration in struct mlx5e_flow_meter_aso_obj with flex-array
member.
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 [2].
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1]
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2]
Link: https://github.com/KSPP/linux/issues/78
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 09 Jan 19:39, Gustavo A. R. Silva wrote: >Zero-length arrays are deprecated[1] and we are moving towards >adopting C99 flexible-array members instead. So, replace zero-length >array declaration in struct mlx5e_flow_meter_aso_obj with flex-array >member. > >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 [2]. > >Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1] >Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2] >Link: https://github.com/KSPP/linux/issues/78 >Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Applied to net-next-mlx5, Thanks!
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c index 78af8a3175bf..7758a425bfa8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c @@ -28,7 +28,7 @@ struct mlx5e_flow_meter_aso_obj { int base_id; int total_meters; - unsigned long meters_map[0]; /* must be at the end of this struct */ + unsigned long meters_map[]; /* must be at the end of this struct */ }; struct mlx5e_flow_meters {