From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C92DE111A0 for ; Mon, 25 Sep 2023 15:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695656730; x=1727192730; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=/oz9+CAICiYxIKLAPMlcwFajtVFMzg2UMgD5Z00t91E=; b=UHHapqbjtXEVQPbXDA5B+ZxUDDDQ+kDcpOEysJtfHf9goyRsjhheGHHs KyPA/KZ1uczTlTQ3z5TmNjFL4neo19jiyMoFLTGM7D6LgFzKJep5G3fqT QlDE5GEDgs9CiKS0djPIiJTY5FoMUcKiv7kevKzUT9SkAPk6y5vvsW3tO uh6ZU/oAPBs6yI8ZX3UlrrAu84aigmM41Wiu+bmly/u2nBpFKCFjPBAbI tCsMVTqMvOMj+u5xf4p+9RrN8jhreR5QXUrU3LYNsPah8juSdlo+T0geE 3Oh0CUUwmJ5y6iVSj26FF40Znmr8ma5eFm7PxW5heWjd4UwctAhtZOAt+ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="385120597" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="385120597" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:45:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="748382090" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="748382090" Received: from stamengx-mobl1.ger.corp.intel.com ([10.249.32.149]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:45:17 -0700 Date: Mon, 25 Sep 2023 18:45:15 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Jithu Joseph cc: Hans de Goede , 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, LKML , platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, pengfei.xu@intel.com Subject: Re: [PATCH v2 6/9] platform/x86/intel/ifs: Metadata validation for start_chunk In-Reply-To: <20230922232606.1928026-7-jithu.joseph@intel.com> Message-ID: References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230922232606.1928026-1-jithu.joseph@intel.com> <20230922232606.1928026-7-jithu.joseph@intel.com> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Fri, 22 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 b09106034fac..c92d313b921f 100644 > --- a/drivers/platform/x86/intel/ifs/load.c > +++ b/drivers/platform/x86/intel/ifs/load.c > @@ -291,6 +291,13 @@ static int validate_ifs_metadata(struct device *dev) > return ret; > } > > + if (ifs_meta->chunks_per_stride != 0 && > + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride)) { I meant that != 0 should be on the second line. -- i. > + 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; > } > >