Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp508400rwo; Tue, 1 Aug 2023 22:41:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlEw3aG6c0Pjl3vGp8J6S6F1kBg8bQqHdnf0XpPxr4bNYow0AbA/UMZ/mDkYbNCL+K7fYqGn X-Received: by 2002:a05:6a00:847:b0:67a:52a7:b278 with SMTP id q7-20020a056a00084700b0067a52a7b278mr19579498pfk.9.1690954881208; Tue, 01 Aug 2023 22:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690954881; cv=none; d=google.com; s=arc-20160816; b=VZJiXZF7hTDp8WyrqsHLF47iESZMDjJVsJall8nUk2hesfW9/9insLrl1Ohvih8p1I oul5tWrYL7DtP0p8+dP7k9r9cb7pG9wZvDIEQKpuk5GRrp7VaHTRQ4Brsg+SK+r+V3td ov0N/OvZLaWoVGtv0Pp89BisOG6uvG9aqiRnAR80mVQizfnjYU1I7MGF28PcfyCpQYDI TrGPssrwf/AKW2X8/eHW3PtuLe8Gv8Y9rP4x0LT4oFvNcNU3TkDDuTmq54S0ripHTsCF JYEw/DfEgxSBGunqrMSSyXdBP+KvdPlxfaKmCPB9W8fH3wn4OQ4LTmNjwr9NQFYkctGR 9hRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fHuHIza0qWwk4bnlegiBooqCBm98VbfuHRDFdFwGhLY=; fh=Ld4bEJMliET3pg5SF4t5/bzEu7hB0dttY59G24FXQc0=; b=JDwPkI9RTeQCnXgiYGegmt/Y/n4do2sP/5ykJnCH9BJed9yej2NQUW3didHYd9H/yk 7CHqQbFpvC2EMADTQJUqAnYNVOsClzwd+m1d1quCJEVV2A716SkTc4lqDXpcA64nG/uX B4WrRfHty+l8yBp3fHmr4HlroR22ptxMmgREyr/J7JzkBuwagZGEoBW3r4egS3oS4v2W CUGV2B0t0U5tlSuciNgjX5sW/IGqOzzye4jPhlLQP4c/LwiPQbUFjEW3K6q1W958pClW eheJWDTxzfy3YNsd7hThcXgDfhXAoEP8Z5uCckHVUyExfU++5MgKNVY1dAzS6DQwhjsV BwHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jIR3DAN3; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a056a00174900b006874bd81592si3359998pfc.139.2023.08.01.22.41.09; Tue, 01 Aug 2023 22:41:21 -0700 (PDT) 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=jIR3DAN3; 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 S229545AbjHBFEe (ORCPT + 99 others); Wed, 2 Aug 2023 01:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232029AbjHBFEb (ORCPT ); Wed, 2 Aug 2023 01:04:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4BA5268E; Tue, 1 Aug 2023 22:04:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 49D43617E2; Wed, 2 Aug 2023 05:04:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F79BC433C7; Wed, 2 Aug 2023 05:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690952667; bh=roMvJpb+EzYKwtQeG0++SvhEzIg74QW7AkwQyMIYc/8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jIR3DAN3rPp40JJ80ZHvkLqrCjGI4pSRFKCrEkL1vHVjBNGUvz3xOLHhxuwLauIXl 2w3Hi13EWZBk9l75KXdGL6arb1bAYS7vRLZvWif0lYIFruJuRKXWZW1imPdW/bQRQE HLH311XABoSVxhP3HRVme9J+NCojqdyrqGM5/2dsSPZfZnaWPpJolWQNNsN40YA50T XTSgR+6axNJjZpTIE5xji6Pg1woOTWvU6UFD3M3+enuWUkQuYpfc8bcbEbeTfiNRQv CtdfFKEfbdRGpccfrBCQ5avkgYsXGxT+36SJkAGGGt+V2rYcBvzr4fvAYxpjs4NhEf +M3pG5cOlt9EQ== Date: Tue, 1 Aug 2023 23:05:31 -0600 From: "Gustavo A. R. Silva" To: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH 1/4][next] i40e: Replace one-element array with flex-array member in struct i40e_package_header Message-ID: <768db2c3764a490118f6850d24f6e49998494b6c.1690938732.git.gustavoars@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,T_SCC_BODY_TEXT_LINE 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 One-element and zero-length arrays are deprecated. So, replace one-element array in struct i40e_package_header with flexible-array member. The `+ sizeof(u32)` adjustments ensure that there are no differences in binary output. Link: https://github.com/KSPP/linux/issues/335 Signed-off-by: Gustavo A. R. Silva --- drivers/net/ethernet/intel/i40e/i40e_ddp.c | 4 ++-- drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ddp.c b/drivers/net/ethernet/intel/i40e/i40e_ddp.c index 7e8183762fd9..0db6f5e3cfcc 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ddp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ddp.c @@ -220,7 +220,7 @@ static bool i40e_ddp_is_pkg_hdr_valid(struct net_device *netdev, netdev_err(netdev, "Invalid DDP profile - size is bigger than 4G"); return false; } - if (size < (sizeof(struct i40e_package_header) + + if (size < (sizeof(struct i40e_package_header) + sizeof(u32) + sizeof(struct i40e_metadata_segment) + sizeof(u32) * 2)) { netdev_err(netdev, "Invalid DDP profile - size is too small."); return false; @@ -281,7 +281,7 @@ int i40e_ddp_load(struct net_device *netdev, const u8 *data, size_t size, if (!i40e_ddp_is_pkg_hdr_valid(netdev, pkg_hdr, size)) return -EINVAL; - if (size < (sizeof(struct i40e_package_header) + + if (size < (sizeof(struct i40e_package_header) + sizeof(u32) + sizeof(struct i40e_metadata_segment) + sizeof(u32) * 2)) { netdev_err(netdev, "Invalid DDP recipe size."); return -EINVAL; diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h index 388c3d36d96a..c3d5fe12059a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_type.h +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h @@ -1456,7 +1456,7 @@ struct i40e_ddp_version { struct i40e_package_header { struct i40e_ddp_version version; u32 segment_count; - u32 segment_offset[1]; + u32 segment_offset[]; }; /* Generic segment header */ -- 2.34.1