From nobody Sat May 18 21:00:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91181+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91181+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1657282321; cv=none; d=zohomail.com; s=zohoarc; b=XV2mGeGCh4rmvJwSbJSnQJLCCIwEp94QDeinI+bHOUzx09wuLCp3lsOR2rQDf1ZFaMffYfzqZbVcMNE0Xi2j2tTtXVF+5fWO58T9LloXONVBePeAspG0QjqRI/4orJLkdD5omKZq+uKRyOKMBGHCvKDgc4mlNajECu7kmAv7gEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657282321; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=XhGsFOxiJQA2vMTcXhZqhK52yUJKX5Kn3Zpwzev9H1k=; b=TlmqE+8V6/zCI3fw0vsc1ZEJEQZe59hHhTqUSRdzwt12+uDSZotK3q2EF/YhgwI6bcMPXUTG0B4w3eQwJ7udAE46+Kq9ARtlziLZqLU+Xkkt0lTuuKIAPVVPQLERoPwExcYmAWjG8gVtGufHPUVBVV8auQEzlgy3LQe8VWLXhRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91181+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1657282321674189.21808868770847; Fri, 8 Jul 2022 05:12:01 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 66maYY1788612xpAVWnDqGhW; Fri, 08 Jul 2022 05:12:01 -0700 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web09.6915.1657282320579590077 for ; Fri, 08 Jul 2022 05:12:00 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10401"; a="264679916" X-IronPort-AV: E=Sophos;i="5.92,255,1650956400"; d="scan'208";a="264679916" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2022 05:11:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,255,1650956400"; d="scan'208";a="720868256" X-Received: from linjaso1-desk1.gar.corp.intel.com ([10.5.215.41]) by orsmga004.jf.intel.com with ESMTP; 08 Jul 2022 05:11:57 -0700 From: "Lin, Jason1" To: devel@edk2.groups.io Cc: Jason1 Lin , Bob Feng , Liming Gao , Yuwei Chen , Dakota Chiang , Vanessa Chuang Subject: [edk2-devel] [PATCH v3] [edk2-platforms] Silicon/Intel/FitGen: Fix CheckOverlap would do incorrect split BiosModule action in corner case Date: Fri, 8 Jul 2022 20:11:55 +0800 Message-Id: <20220708121155.2029-1-jason1.lin@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jason1.lin@intel.com X-Gm-Message-State: cy3tSHth2y40jSQYcb1LfMiNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1657282321; bh=eXeVfnc5EJnPPqcTiYVvk7mi8zw07zekOjdITAC2eU0=; h=Cc:Date:From:Reply-To:Subject:To; b=mN22K/Y5xEKJF5YYyUZ/MAo+MTv2gJbM+5hOQDNbtHa8xtKynQrpgg9dmJaYViLls8Z 8r4wMiRn47vPjj0oKLBsmyAP/LRGqhnh2sL5jZpVWxCDFSskJhBrkmpJgHN/8ppIJY8h8 JZwzjCn1PGLFxL0JDksrxF8aQVOjTkxpUz4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1657282323041100003 Content-Type: text/plain; charset="utf-8" From: Jason1 Lin REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3922 [Description] CheckOverlap function would do incorrect split on the BiosModule which not = happen overlap. This would cause incorrect value locate in FIT entry record. [Condition] - This BiosModule base address is lower than input address. - This BiosModule size is smaller than input size. [Resolution] - Do the check on BiosModule size and input size value to prevent possible negative value. Signed-off-by: Jason1 Lin Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Cc: Dakota Chiang Cc: Vanessa Chuang --- Silicon/Intel/Tools/FitGen/FitGen.c | 31 ++++++++++++++++++++ Silicon/Intel/Tools/FitGen/FitGen.h | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index 577ce48b10..6af7f8e2d9 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -820,11 +820,42 @@ CheckOverlap ( IN UINT32 Address, IN UINT32 Size ) +/*++ + +Routine Description: + + Check whether the input address and size is overlap with any BiosModule. + If happen overlap, need to be deal with this case. + --- +--------------+ <------ BiosModule A Base +-----= ---------+ + | | | | = | + | | | Bio= sModule | + | | | = A | + | | | = | + BiosModule A +--------------+ <------ [Input] Address =3D=3D=3D=3D> = +--------------+ + Size | | | + | | | [Input] Size + +--------------+ ------ +-----= ---------+ + | | | Bio= sModule | + | | | | = B | + --- +--------------+ +-----= ---------+ + +Arguments: + + Address - The address of the buffer that required to check. + Size - The size of the buffer that required to check. + +Returns: + + None + +--*/ + { INTN Index; =20 for (Index =3D 0; Index < (INTN)gFitTableContext.BiosModuleNumber; Index= ++) { if ((gFitTableContext.BiosModule[Index].Address <=3D Address) && + (gFitTableContext.BiosModule[Index].Size >=3D Size) && ((gFitTableContext.BiosModule[Index].Size - Size) >=3D (Address - = gFitTableContext.BiosModule[Index].Address))) { UINT32 TempSize; INT32 SubIndex; diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitG= en/FitGen.h index 80a1423ceb..769e2fda99 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Utility version information // #define UTILITY_MAJOR_VERSION 0 -#define UTILITY_MINOR_VERSION 66 +#define UTILITY_MINOR_VERSION 67 #define UTILITY_DATE __DATE__ =20 // --=20 2.37.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#91181): https://edk2.groups.io/g/devel/message/91181 Mute This Topic: https://groups.io/mt/92249869/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-