From nobody Tue Apr 30 06:24:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44448+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44448+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1564127210; cv=none; d=zoho.com; s=zohoarc; b=KszsZ1vZU0v5+ieIKO4zdycutllWflJYD9riyi+7u5sQje2VnR8UTxXEkEk0knHUyS25rJ41QD8ztFVnOZAodvcC/PcIXjEDgTqbn9FwUitQTakFuEig8A6yBJuJVnjSGL0GPZZP6WOv8z9kjZZBZ8aqxfr6y0aAGh7oHNzkDww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564127210; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=FafdvaEvuE/TXwJU8lPAEDOB4eOhN2V91916y1dQgP4=; b=Ot92Jy2ZMzHKD/cqfDyAMS5+53w3TT3HGS4bg8Eo12Cw8TxBkGs45HUEmBQcmiN17t2GXJ1HOY7DJAFmpS2bpSLk+PIIvwI0jf/wN8ZfFvtHnZ8kDmUXR//48nnhh6p0q9tHWsrJ8QGQ2nj8RjpYxPRyDxLpQ3NeYGNFNTrb1Ws= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44448+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 156412721085948.83868642852997; Fri, 26 Jul 2019 00:46:50 -0700 (PDT) Return-Path: X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Fri, 26 Jul 2019 00:46:49 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 00:46:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,310,1559545200"; d="scan'208";a="164497454" X-Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga008.jf.intel.com with ESMTP; 26 Jul 2019 00:46:48 -0700 X-Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 26 Jul 2019 00:46:47 -0700 X-Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 26 Jul 2019 00:46:47 -0700 X-Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.65]) with mapi id 14.03.0439.000; Fri, 26 Jul 2019 15:46:44 +0800 From: "Gao, Zhichao" To: "devel@edk2.groups.io" CC: "Carsey, Jaben" , "Ni, Ray" , Andrew Fish Subject: FW: [edk2-devel] [PATCH V2] ShellPkg/UefiHandleParsingLib: Fix incorrect reallocate pool Thread-Topic: [edk2-devel] [PATCH V2] ShellPkg/UefiHandleParsingLib: Fix incorrect reallocate pool Thread-Index: AQHVQFrgGSxL3Rd2xk+XkyYQC0+UvKbci4Xg Date: Fri, 26 Jul 2019 07:46:43 +0000 Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B817D47@SHSMSX101.ccr.corp.intel.com> References: <20190722065756.18856-1-zhichao.gao@intel.com> <15B3A870E6EA7BDB.7925@groups.io> In-Reply-To: <15B3A870E6EA7BDB.7925@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,zhichao.gao@intel.com Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1564127210; bh=MzsWR4iL91EArefP46zbwnmxDWvyFZ1+nA7LXssGpqk=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=YDvBoPKNxL4lqIjkLzKJac/eKjuS6ULX+g2bQTbeezjkOifTum0ICRgtgbAMwNIZgUh Kfm7bG6WPz4cYfVvA5JRZjvGS7TcpTmVovFkNtRsU2CiWw9L95qUHX9Vip1LFmWOoDTTl 2ezrBv9kxG+Y8DH3IMWA7Q+GfixoSZj8XJg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Ping. Please help to review it. Thanks, Zhichao -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Gao, = Zhichao Sent: Monday, July 22, 2019 2:58 PM To: devel@edk2.groups.io Cc: Carsey, Jaben ; Ni, Ray ; And= rew Fish Subject: [edk2-devel] [PATCH V2] ShellPkg/UefiHandleParsingLib: Fix incorre= ct reallocate pool REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1965 For function InsertNewGuidNameMapping, it rellocate the mGuidList with new = size "mGuidListCount+1 * sizeof(GUID_INFO_BLOCK)". That isn't its purpose and wo= uld cause a overflow operation in "mGuidList[mGuidListCount - 1].xxx =3D xx= x". Its purpose is to increase 1 block size of mGuidList. Change it to "(mG= uidListCount + 1) * sizeof (GUID_INFO_BLOCK)". Adjust the coding style of this function. Cc: Jaben Carsey Cc: Ray Ni Cc: Andrew Fish Signed-off-by: Zhichao Gao --- V2: Update the copyright. .../UefiHandleParsingLib/UefiHandleParsingLib.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b= /ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index f179c41092..43c19b9a91 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -1,7 +1,7 @@ /** @file Provides interface to advanced shell functionality for parsing both hand= le and protocol database. =20 - Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights=20 + reserved.
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -2462,17 +2462,21 @@ Ins= ertNewGuidNameMapping( IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL ) { - ASSERT(Guid !=3D NULL); - ASSERT(NameID !=3D 0); + ASSERT (Guid !=3D NULL); + ASSERT (NameID !=3D 0); =20 - mGuidList =3D ReallocatePool(mGuidListCount * sizeof(GUID_INFO_BLOCK), m= GuidListCount+1 * sizeof(GUID_INFO_BLOCK), mGuidList); + mGuidList =3D ReallocatePool ( + mGuidListCount * sizeof (GUID_INFO_BLOCK), + (mGuidListCount + 1) * sizeof (GUID_INFO_BLOCK), + mGuidList + ); if (mGuidList =3D=3D NULL) { mGuidListCount =3D 0; return (EFI_OUT_OF_RESOURCES); } mGuidListCount++; =20 - mGuidList[mGuidListCount - 1].GuidId =3D AllocateCopyPool(sizeof(EFI_G= UID), Guid); + mGuidList[mGuidListCount - 1].GuidId =3D AllocateCopyPool (sizeof (EFI= _GUID), Guid); mGuidList[mGuidListCount - 1].StringId =3D NameID; mGuidList[mGuidListCount - 1].DumpInfo =3D DumpFunc; =20 -- 2.21.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 (#44448): https://edk2.groups.io/g/devel/message/44448 Mute This Topic: https://groups.io/mt/32607150/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-