Message ID | 20230929202436.2850388-7-jithu.joseph@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp141493vqb; Fri, 29 Sep 2023 18:30:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwdA8d+KKBkXTp371na9g4dpl8SmA/xcwrfekOnNMaXh721Yf4CxAHrof3cfQMPuy0V2/Y X-Received: by 2002:a17:90a:740a:b0:274:3a86:4c10 with SMTP id a10-20020a17090a740a00b002743a864c10mr5379810pjg.29.1696037453583; Fri, 29 Sep 2023 18:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696037453; cv=none; d=google.com; s=arc-20160816; b=yHdDpS8yUpZLExVeUZHrt29VrcPqOUu/y8wGksY/u4eWMVqD80eT1KJ72ghrd+03dI Li6s771qwj7FeACM+9cjI3ZukNcOphap5IDIzOn7Yf1s9V/7UreKi7UR5x9qLwMxyZXj K/gEQ/CmpDHKuH/p49/W1A3HR0re49mcp9NLfL6+GaXdPMFVEmsXvF5IUoWYHyBV+89S o7nMbvi+BrYUB/QoKbRhJlLu/3hVQvEFtMPr3pWcV2C7toFjXJshJHVlYMisqC4gWAEg 1ud1CmCS2c6RCroiYIdAN5xysyXlq8Z5M4vOC7NW6+TTTrtnCbR5tVdN+ZKpVg8fnNzF laMw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=em5EKun9E0QHIDf2wihnSrlPsqvE0nbE2/577eBb4Gk=; fh=DZTEBuCdFfe2DSdaI+6ceTR59ce872SNjmboNXW/0pA=; b=eaEnn5S4VZ8SLPZCasIeCMyDMux0Rqwc3qPKqeEDVoBbPs/URFIliX75uJyE6TuR1H 9dxNfsnU2qfU+6T2pFgjl9PduwP1/o6fQIIcSJWcdlNG5/jLuoyexovlHG+P+GM7EJOp /G4Zp5ecD+uVlVedSrYkCoy2FZ/+dvfWchgB/2jmCKNNob/ZDkY5sm4HysbYajorVTcf BuPSx0UaP1Wcpq47vBYE9mmgV/Tb+DCitrVtEd7lkU01P56X8Gujb+75oz5nQ4dQiCn5 B9I8P4++i0reBMheFeabx+sBeXahEN6zUASsPh0G6i/tkxUcxfCXU08pwb8TvPk7sKtj 1ypQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PK2aTy3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id lr3-20020a17090b4b8300b00277630078f9si2929396pjb.12.2023.09.29.18.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 18:30:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PK2aTy3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 4FF5E801C7C4; Fri, 29 Sep 2023 13:46:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233982AbjI2Upw (ORCPT <rfc822;pwkd43@gmail.com> + 19 others); Fri, 29 Sep 2023 16:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbjI2Up2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 29 Sep 2023 16:45:28 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D3CCC0; Fri, 29 Sep 2023 13:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696020325; x=1727556325; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o0NPgjek+yICKBayQpefXYkdLE9/OZrQjlimuyKug84=; b=PK2aTy3e2aCgy9hsfbIf+1sQmm52kp4uEU1VoEPhBfE0B4Hyik8TxozA hfenrLk1MwiHzJWMgPJvKDPCYu+Z8x3z0gfAhgepx/bhVQIyko9UsIn1V p0Yk5MMgSl9S7Xncu+awzqXPIY9/UZj0s18y0GVnM3XSfeQz3QoatqXPT Z64zCykAgEgjcUD7pz7he2t8VrJPr13AdxkI5YKHm0z3AjeKECCQ4H9q5 Esrx6SnObHUiopWZbSEgD/C2t9GFm/gTwURGwMeaSl+k6qoih4fpkkFtq 2AaZ6Gg8dzGEUap4qCFU+n33j9BPRNrjui1iILrogmmHhN3WreTxrcFox g==; X-IronPort-AV: E=McAfee;i="6600,9927,10848"; a="468654471" X-IronPort-AV: E=Sophos;i="6.03,188,1694761200"; d="scan'208";a="468654471" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 13:28:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10848"; a="893539248" X-IronPort-AV: E=Sophos;i="6.03,188,1694761200"; d="scan'208";a="893539248" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 13:27:30 -0700 From: Jithu Joseph <jithu.joseph@intel.com> To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rostedt@goodmis.org, jithu.joseph@intel.com, 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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v3 6/9] platform/x86/intel/ifs: Metadata validation for start_chunk Date: Fri, 29 Sep 2023 13:24:33 -0700 Message-Id: <20230929202436.2850388-7-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230929202436.2850388-1-jithu.joseph@intel.com> References: <20230922232606.1928026-1-jithu.joseph@intel.com> <20230929202436.2850388-1-jithu.joseph@intel.com> MIME-Version: 1.0 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_BLOCKED,SPF_HELO_NONE,SPF_NONE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 13:46:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776950852170563737 X-GMAIL-MSGID: 1778424168950259850 |
Series |
IFS support for GNR and SRF
|
|
Commit Message
Jithu Joseph
Sept. 29, 2023, 8:24 p.m. UTC
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 <jithu.joseph@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> --- drivers/platform/x86/intel/ifs/load.c | 7 +++++++ 1 file changed, 7 insertions(+)
Comments
On Fri, 29 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 <jithu.joseph@intel.com> > Reviewed-by: Tony Luck <tony.luck@intel.com> > Tested-by: Pengfei Xu <pengfei.xu@intel.com> > --- > 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 da54fd060878..6f8abb4729e9 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 && > + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride != 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); Please use %u as both are u32s.
On 10/2/2023 4:47 AM, Ilpo Järvinen wrote: > On Fri, 29 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 <jithu.joseph@intel.com> >> Reviewed-by: Tony Luck <tony.luck@intel.com> >> Tested-by: Pengfei Xu <pengfei.xu@intel.com> >> --- >> 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 da54fd060878..6f8abb4729e9 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 && >> + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride != 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); > > Please use %u as both are u32s. > Thanks for the review... I will make this change Jithu
diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index da54fd060878..6f8abb4729e9 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 && + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride != 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; }