Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4873732rdb; Fri, 15 Sep 2023 15:21:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqaJdofGsRAmiVSzqG+T7BlcUwtf2mAwDWJJfcYYQBJAlAgoXrnZBV5lGEDigYb8kNZSCP X-Received: by 2002:a05:6a20:9790:b0:157:b7d3:2bcb with SMTP id hx16-20020a056a20979000b00157b7d32bcbmr2765934pzc.27.1694816487288; Fri, 15 Sep 2023 15:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694816487; cv=none; d=google.com; s=arc-20160816; b=uKMa3+f3HOuGPUXSNQ8CFvmr7GUc44e09/PP/aXxBoPEybf6I9XbjbPztufWDHPE/M 3RYI1gxwoUbsiIUD2FwZRblfvIZKU0wKjwMTLdZU4Yk7cfbTGkydRfd/Hxl+p9ZThl50 MdMWLgDJrxxU+My0vgphP9Qj3CTQP3tWoHETErLCkfKzElDe9w00mgUqp+ef1Xnvoy60 zxkbuSN9sZLOvG2EO7AnaDr0+9a7YQtJ1eelzMZlJkEeXIlMP863rpWEzsXa4mePcOt6 rVH1s9gZ8RNARknhlx1SKygSLvR/hx35KNxkj3VNqItoOeAow2bZD5mQoqgtQ/k83DOh GyTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=0zyfgkhIKhpJOfggk7SYK2d4HzYqvdi1NQOi3RfMyBM=; fh=K2GM5v+nVwO6ZuN/Z8kiBzkmUG39Q9bUAXLt7esKjHI=; b=ljUoHgIx+nmQrhX0dwGVZBbg/rSkx1EYFoWp39aJM1aGCM76VkzpDjvkOvN/HCW9yg 4xuNT/pbVaKlZG4s6H5zSl/xZPL8TtqeVlZ6t1GpnO4abX6W6wy0FYwyMChMjySRfuG6 B3eOX8VghBbQb8ZJ5o8x+bY2i8rWajOPb/UbN4td17YWM0Ynp2ldCeG6j4O3S097INoN QFCJQdtZz+ooslPxMARhEe9SUx0ri0UhqBJsi4cB3jgIqgtNFVHSjCkO2QCR69ue01WX Scqrf67F/VtJTGkxg2kNtrTplsAZVfrbFpFP6ZEmM2LOpSlcLPfu4EhISETEhi/7wFhL VG+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AJg4kdsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id z11-20020a65610b000000b0056c0e3c77f7si3739276pgu.805.2023.09.15.15.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 15:21:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AJg4kdsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3835F82A8889; Fri, 15 Sep 2023 10:01:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234971AbjIORBY (ORCPT + 99 others); Fri, 15 Sep 2023 13:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235238AbjIORAw (ORCPT ); Fri, 15 Sep 2023 13:00:52 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F5F270A; Fri, 15 Sep 2023 10:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694797206; x=1726333206; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=TkyxTjmo4j+T1tGFjWBvv1CU6NTsv9h5dOWGiYDUv3o=; b=AJg4kdsQOnfgtnFJDvI0mVWiLzgQTv4sNaH8D/YoLr0wE7LOnD+kSBc9 RnAURQuoowIbVU0cYf97jytmXAjSXMOtDZq+IJ8Vij1MvKdnWXe5r9ori inQDJRIEKHsiHR07AcOINwEbcqCOTPjWlE2heMJG/UmQZJiLWrDG1aX1r 0oSGjRad7SBUuu5MuY1HvDNz3CirxldC4QVdekF5RPIbjqdP0Nm1wu/qa 3b8LV3KXDu7PhJh3RPGxDj5ATpD2NezexFEQc5o3mHPAuXrDaUHtqnSo7 jsBSrrZyGGq1dfD1N3z+gAnpwOUn40kE3HMRk0gF8nydjFejEhyl4Vpi5 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="378208052" X-IronPort-AV: E=Sophos;i="6.02,149,1688454000"; d="scan'208";a="378208052" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 10:00:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="835268158" X-IronPort-AV: E=Sophos;i="6.02,149,1688454000"; d="scan'208";a="835268158" Received: from srdoo-mobl1.ger.corp.intel.com ([10.252.38.99]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 10:00:01 -0700 Date: Fri, 15 Sep 2023 19:59:59 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Jithu Joseph cc: hdegoede@redhat.com, markgross@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rostedt@goodmis.org, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, pengfei.xu@intel.com Subject: Re: [PATCH 07/10] platform/x86/intel/ifs: Metadata validation for start_chunk In-Reply-To: <20230913183348.1349409-8-jithu.joseph@intel.com> Message-ID: <3dc5207d-37b7-52fe-954-889d5456192d@linux.intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230913183348.1349409-8-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 10:01:56 -0700 (PDT) On Wed, 13 Sep 2023, Jithu Joseph wrote: > Add an additional check to validate IFS image metadata field > prior to loading the test image. > > If start_chunk is not a multiple of chunks_per_stride error out. > > Signed-off-by: Jithu Joseph > Reviewed-by: Tony Luck > Tested-by: Pengfei Xu > --- > drivers/platform/x86/intel/ifs/load.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c > index 778a3b89a24d..88630366a23c 100644 > --- a/drivers/platform/x86/intel/ifs/load.c > +++ b/drivers/platform/x86/intel/ifs/load.c > @@ -292,6 +292,13 @@ static int validate_ifs_metadata(struct device *dev) > return ret; > } > > + if (ifs_meta->chunks_per_stride && > + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride)) { While this is not incorrect, it would make the code easier to understand if you add != 0. > + dev_warn(dev, "Starting chunk num %d not a multiple of chunks_per_stride %d\n", > + ifs_meta->starting_chunk, ifs_meta->chunks_per_stride); > + return ret; > + } > + > return 0; > } > > -- i.