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 A2801C61DA4 for ; Thu, 9 Feb 2023 17:26:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230062AbjBIR0K (ORCPT ); Thu, 9 Feb 2023 12:26:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjBIR0J (ORCPT ); Thu, 9 Feb 2023 12:26:09 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6485A66EEC for ; Thu, 9 Feb 2023 09:26:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675963568; x=1707499568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fHXo6ApTB3zduMWDDlzyMnxUIDah2FaKjMBee3KFFr0=; b=gdMdV01zRdpABQIGBmmScN9dVw2PwadldsJsRlGM7PjCxOQGqF4b1p4d tsfYC+9GOkViWxOhYsRelO897J5sNl8/Kge9K7YfAjDbSwAzMf1CuqPxW wOkssbzwUPQQ4YmL4gbDWE1FPGrAasT8B4CIV+MNVyBqioKVva19OE57n 0erkSifr4KrslPPsqD/gIX564A1In7xsB58XgNZSAL5X1pknVLZm60rP6 OvmBzmZyShtWIF5AJTG7OCBNOj/VliNdJR0Mjtj+/OBcrUtTf9+xElnbv 1fqDnynXnBlPqcryt3Dz980YcyOSoyJaHfEZW9rxGTV5nAn+10DI5NlLi g==; X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="328816317" X-IronPort-AV: E=Sophos;i="5.97,284,1669104000"; d="scan'208";a="328816317" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2023 09:26:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="756491303" X-IronPort-AV: E=Sophos;i="5.97,284,1669104000"; d="scan'208";a="756491303" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by FMSMGA003.fm.intel.com with ESMTP; 09 Feb 2023 09:26:04 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com Cc: Kees Cook , netdev@vger.kernel.org, anthony.l.nguyen@intel.com, Jesse Brandeburg , "Gustavo A. R. Silva" , intel-wired-lan@lists.osuosl.org, Jiri Pirko , Gurucharan G Subject: [PATCH net-next v2 5/5] net/i40e: Replace 0-length array with flexible array Date: Thu, 9 Feb 2023 09:25:36 -0800 Message-Id: <20230209172536.3595838-6-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230209172536.3595838-1-anthony.l.nguyen@intel.com> References: <20230209172536.3595838-1-anthony.l.nguyen@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Kees Cook 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 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 Cc: Tony Nguyen Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: "Gustavo A. R. Silva" Cc: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Reviewed-by: Jiri Pirko Tested-by: Gurucharan G (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- 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 c13b1e57f864..60ce4d15d82a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -177,7 +177,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.38.1