Message ID | 20230105234557.never.799-kees@kernel.org |
---|---|
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 p1csp561386wrt; Thu, 5 Jan 2023 16:24:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwHhh1hsvNiHM3m2KDRc+6nipgRmq4bD6gbMC4bJHnv5xPogr8a3ahY9QFH3JD6cQiPNhz X-Received: by 2002:a17:906:85c2:b0:7ad:aed6:5224 with SMTP id i2-20020a17090685c200b007adaed65224mr46214295ejy.74.1672964663830; Thu, 05 Jan 2023 16:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672964663; cv=none; d=google.com; s=arc-20160816; b=mhYG1BNnOd0QqHaFdT7FgqVOxpCIyVo12FC7S2OnH4fd3oW3S35dfreEExn+yeItTX FztSaFobS+8HkGL8kmiNuc6FcNyFOozcwTkC9d6xkrwecj21DTpC/y9Xv5chw4Wonmw8 DiYWAKYVbvTr+iDzeFEhIxZ8ujs8puwL1eZI6dGbiqCUHoS1QkE6vg8ZEji+piLyRCFS Z36WpOtm1Jjwc1RRBHx4paI0usIIB0oaPTt2CN8UWxqJ99Me/EA980/MX8irSjoKdC1I N7j6VrLXk+OzDPKnfxISyJPVFERpWDhBIyPBk6lNG69iuKVHS8Kq9nxPvt/20Rzi4h29 B4CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Ixmy6mGcgoBkvJjym9GQ9iC/bNIzdQTH6bspDgeDvy4=; b=XiDu8BGR9boExlMXMsVYXQ+kJbJbgyo2FafnZLtuyahePI3haRLNV7Yb/auAjLPZ1b 9kqDOpOuQ5NB9SVVEqKNN9dctuK+57EsDMZaq9/sWYxt1YlX9MF22JOlOol8ml4Hwg6+ PRDwe5psS2u2MpDzz/OSc1+XuE73ALMGrlJHazgP/VnI61s/feWg5VTLZysTXDoFF4fP AOwbOADF5sx7XP83RCNX9fAQxG2iA3t3rjOIQk4T+Ei+kbUsbvtMSGH9ySUdqviaihFe dQOL4bEwe6OOCFIkiLFFPkQ/aenxgZ8mJobljQc6nJzap8wgbprqmE/ozjZ1K/HwW/C0 N6Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GQGTpbZ8; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt8-20020a170906ee8800b0078d288ddfc9si35424107ejb.143.2023.01.05.16.24.00; Thu, 05 Jan 2023 16:24:23 -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=@chromium.org header.s=google header.b=GQGTpbZ8; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235651AbjAEXqH (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Thu, 5 Jan 2023 18:46:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235525AbjAEXqF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 5 Jan 2023 18:46:05 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C9F5F8D for <linux-kernel@vger.kernel.org>; Thu, 5 Jan 2023 15:46:04 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id fz16-20020a17090b025000b002269d6c2d83so4641429pjb.0 for <linux-kernel@vger.kernel.org>; Thu, 05 Jan 2023 15:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ixmy6mGcgoBkvJjym9GQ9iC/bNIzdQTH6bspDgeDvy4=; b=GQGTpbZ8i0H+pQVuEFS/65Vxh3N38d3B8Qxa0GhO13fYdDKPLvvcDpThsjFzLgM3iN HqqSkAojzTJ1ZyfI/h4Zf+xjZKbxsjbwWQnvxDePVyJWrCGpv9CFrDDTQBEsvMy/HxmT X6Xrpxmz7XzHy8xBw1arDnEJJ7/R1G+IWVPzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ixmy6mGcgoBkvJjym9GQ9iC/bNIzdQTH6bspDgeDvy4=; b=x0nymAl/143IHyxZmCaz9f/qU+Y0uV3dZutSiip1RTKdNwqCs6JpvWZL6Q7HLqDqOC qLaDjCpQThnsFZKd4QCMPaT72uMpm6K7vHd/WzGg2fWj+nNYllRizX/GKNNdNnFMI5sm mrYXP0arlNeWGJrkHs96YpAJ33PjqFgPqsmWrcYv3CdzSyL+jWhBDSowogT+UdHTvWu2 Xwn9mN3Kac4KRK4kPlXu/1Y8Q/RCzCj3odE+IhXcmpBcZ8+Ayxj9rIL3ojWy1zo7Gnu0 jyPPiiW1W0MfgqGmzXJL/boT7pZive5LigH11Mb5oo5p7wwj0L5BYrCMmPwKwsUtVHb5 VB4Q== X-Gm-Message-State: AFqh2kqWcjFB+5VjbJJZ5YuvEPgLucZZUZiU6Ks1j8A2tt7/X2Dclacp OG1zSGqkr9DMx0wKtXtKnuEd0A== X-Received: by 2002:a17:902:8698:b0:193:a5b:ccf6 with SMTP id g24-20020a170902869800b001930a5bccf6mr1196588plo.0.1672962364271; Thu, 05 Jan 2023 15:46:04 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z5-20020a170903018500b0019258bcf3ffsm26402243plg.56.2023.01.05.15.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 15:46:03 -0800 (PST) From: Kees Cook <keescook@chromium.org> To: Jesse Brandeburg <jesse.brandeburg@intel.com> Cc: Kees Cook <keescook@chromium.org>, Tony Nguyen <anthony.l.nguyen@intel.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, "Gustavo A. R. Silva" <gustavoars@kernel.org>, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] net/i40e: Replace 0-length array with flexible array Date: Thu, 5 Jan 2023 15:46:01 -0800 Message-Id: <20230105234557.never.799-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1893; h=from:subject:message-id; bh=7oqp1H8bnjca8UKRWJizcoup+xvwTPIAvLIjStmgIhg=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjt2E5B/QBFZKrXqubEBxJWkonAnCaVOq5GJ3FscS0 OD9vd36JAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCY7dhOQAKCRCJcvTf3G3AJlTVD/ 4hn023GoXsD0/jMdOjvZG3DjtedIRTLFclHpsVnAfKSEwTg9hkk/Z6AHKcCC/WsDyxnUfMCXmW5jZz 8ziYYoZzJHtBy0M7wBUgzgxwdH9sOgg94Qj9AEj/ovDnfjJNMSSrorxm/PJre/U+RT3Hb9X3/W09I1 Y1xRSvrO5TTjHUAOP90f7bnvp5A0BQ6uQ3RL6C0eOxSTcrVxhrv4pJiGYpRqW+xAa6dPkuYnw+zzwl 0ItMswnDOsTQytcjgtcPqRqw7pmH5vzyGRzwkVo5V2TnNt3skeKNBMTfxnXrF6yOE1AMbun+X6rNzY R2XlShoDgfUIYEb7VF96k2Vwg9mF8fM+g0jC2iZjqmERyDj1Mnqu6s145AMUOv+z2LNUS3LvvF5xZr 4+zoKrc14NELHWb1CZ6lCgBz/uyc9K6vGWTGTvLV080sqUd54uqJ00veOOAZRLij6afsCdGiiIzkZD H3Q860ipa63ykgKuAmxBGCuEyaWmzWO8NAyLN42H/gqOsV8Ydo7hpyWDOlDr8rvzmsq7XsZuMyLVib CXLtVIl18PrWLD4XpRayzh2gnMiIVnii32h496olyVC6QmZ9KKmM3zEhhoWojrFNclPf/HdZr4V+5x gtdYTagMrjmZ0n/yK08TAFqvMorhfXCKn5GqRMGQ90A5mg4MbO3wFzI/L8VA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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?1754230595114458345?= X-GMAIL-MSGID: =?utf-8?q?1754230595114458345?= |
Series |
net/i40e: Replace 0-length array with flexible array
|
|
Commit Message
Kees Cook
Jan. 5, 2023, 11:46 p.m. UTC
Zero-length arrays are deprecated[1]. Replace struct i40e_lump_tracking's
"list" 0-length array with a flexible array. Detected with GCC 13,
using -fstrict-flex-arrays=3:
In function 'i40e_put_lump',
inlined from 'i40e_clear_interrupt_scheme' at drivers/net/ethernet/intel/i40e/i40e_main.c:5145:2:
drivers/net/ethernet/intel/i40e/i40e_main.c:278:27: warning: array subscript <unknown> is outside array bounds of 'u16[0]' {aka 'short unsigned int[]'} [-Warray-bounds=]
278 | pile->list[i] = 0;
| ~~~~~~~~~~^~~
drivers/net/ethernet/intel/i40e/i40e.h: In function 'i40e_clear_interrupt_scheme':
drivers/net/ethernet/intel/i40e/i40e.h:179:13: note: while referencing 'list'
179 | u16 list[0];
| ^~~~
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Jan 05, 2023 at 03:46:01PM -0800, Kees Cook wrote: > Zero-length arrays are deprecated[1]. Replace struct i40e_lump_tracking's > "list" 0-length array with a flexible array. Detected with GCC 13, > using -fstrict-flex-arrays=3: > > In function 'i40e_put_lump', > inlined from 'i40e_clear_interrupt_scheme' at drivers/net/ethernet/intel/i40e/i40e_main.c:5145:2: > drivers/net/ethernet/intel/i40e/i40e_main.c:278:27: warning: array subscript <unknown> is outside array bounds of 'u16[0]' {aka 'short unsigned int[]'} [-Warray-bounds=] > 278 | pile->list[i] = 0; > | ~~~~~~~~~~^~~ > drivers/net/ethernet/intel/i40e/i40e.h: In function 'i40e_clear_interrupt_scheme': > drivers/net/ethernet/intel/i40e/i40e.h:179:13: note: while referencing 'list' > 179 | u16 list[0]; > | ^~~~ > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > > Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> > Cc: Tony Nguyen <anthony.l.nguyen@intel.com> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Cc: intel-wired-lan@lists.osuosl.org > Cc: netdev@vger.kernel.org > Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Thanks! -- Gustavo > --- > drivers/net/ethernet/intel/i40e/i40e.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h > index 60e351665c70..3a1c28ca5bb4 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e.h > +++ b/drivers/net/ethernet/intel/i40e/i40e.h > @@ -176,7 +176,7 @@ enum i40e_interrupt_policy { > > struct i40e_lump_tracking { > u16 num_entries; > - u16 list[0]; > + u16 list[]; > #define I40E_PILE_VALID_BIT 0x8000 > #define I40E_IWARP_IRQ_PILE_ID (I40E_PILE_VALID_BIT - 2) > }; > -- > 2.34.1 > > _______________________________________________ > Intel-wired-lan mailing list > Intel-wired-lan@osuosl.org > https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Fri, Jan 06, 2023 at 12:46:01AM CET, keescook@chromium.org wrote: >Zero-length arrays are deprecated[1]. Replace struct i40e_lump_tracking's >"list" 0-length array with a flexible array. Detected with GCC 13, >using -fstrict-flex-arrays=3: > >In function 'i40e_put_lump', > inlined from 'i40e_clear_interrupt_scheme' at drivers/net/ethernet/intel/i40e/i40e_main.c:5145:2: >drivers/net/ethernet/intel/i40e/i40e_main.c:278:27: warning: array subscript <unknown> is outside array bounds of 'u16[0]' {aka 'short unsigned int[]'} [-Warray-bounds=] > 278 | pile->list[i] = 0; > | ~~~~~~~~~~^~~ >drivers/net/ethernet/intel/i40e/i40e.h: In function 'i40e_clear_interrupt_scheme': >drivers/net/ethernet/intel/i40e/i40e.h:179:13: note: while referencing 'list' > 179 | u16 list[0]; > | ^~~~ > >[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > >Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> >Cc: Tony Nguyen <anthony.l.nguyen@intel.com> >Cc: "David S. Miller" <davem@davemloft.net> >Cc: Eric Dumazet <edumazet@google.com> >Cc: Jakub Kicinski <kuba@kernel.org> >Cc: Paolo Abeni <pabeni@redhat.com> >Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> >Cc: intel-wired-lan@lists.osuosl.org >Cc: netdev@vger.kernel.org >Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Kees Cook > Sent: Friday, January 6, 2023 5:16 AM > To: Brandeburg, Jesse <jesse.brandeburg@intel.com> > Cc: Kees Cook <keescook@chromium.org>; intel-wired-lan@lists.osuosl.org; > Gustavo A. R. Silva <gustavoars@kernel.org>; linux-kernel@vger.kernel.org; > Eric Dumazet <edumazet@google.com>; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; linux-hardening@vger.kernel.org; > netdev@vger.kernel.org; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni > <pabeni@redhat.com>; David S. Miller <davem@davemloft.net> > Subject: [Intel-wired-lan] [PATCH] net/i40e: Replace 0-length array with > flexible array > > Zero-length arrays are deprecated[1]. Replace struct i40e_lump_tracking's > "list" 0-length array with a flexible array. Detected with GCC 13, using -fstrict- > flex-arrays=3: > > In function 'i40e_put_lump', > inlined from 'i40e_clear_interrupt_scheme' at > drivers/net/ethernet/intel/i40e/i40e_main.c:5145:2: > drivers/net/ethernet/intel/i40e/i40e_main.c:278:27: warning: array subscript > <unknown> is outside array bounds of 'u16[0]' {aka 'short unsigned int[]'} [- > Warray-bounds=] > 278 | pile->list[i] = 0; > | ~~~~~~~~~~^~~ > drivers/net/ethernet/intel/i40e/i40e.h: In function > 'i40e_clear_interrupt_scheme': > drivers/net/ethernet/intel/i40e/i40e.h:179:13: note: while referencing 'list' > 179 | u16 list[0]; > | ^~~~ > > [1] > https://www.kernel.org/doc/html/latest/process/deprecated.html#zero- > length-and-one-element-arrays > > Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> > Cc: Tony Nguyen <anthony.l.nguyen@intel.com> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Cc: intel-wired-lan@lists.osuosl.org > Cc: netdev@vger.kernel.org > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > drivers/net/ethernet/intel/i40e/i40e.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 60e351665c70..3a1c28ca5bb4 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -176,7 +176,7 @@ enum i40e_interrupt_policy { struct i40e_lump_tracking { u16 num_entries; - u16 list[0]; + u16 list[]; #define I40E_PILE_VALID_BIT 0x8000 #define I40E_IWARP_IRQ_PILE_ID (I40E_PILE_VALID_BIT - 2) };