From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8AC8081DC3 for ; Fri, 9 Dec 2016 02:20:54 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 09 Dec 2016 02:20:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,323,1477983600"; d="scan'208";a="38508292" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 09 Dec 2016 02:20:54 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 9 Dec 2016 02:20:53 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 9 Dec 2016 02:20:53 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.11]) by shsmsx102.ccr.corp.intel.com ([169.254.2.37]) with mapi id 14.03.0248.002; Fri, 9 Dec 2016 18:20:49 +0800 From: "Zeng, Star" To: "Gao, Liming" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zeng, Star" Thread-Topic: [Patch] MdeModulePkg PiSmmCore: Update FreePages to handle zero address and pages Thread-Index: AQHSS57iteDSDalJYkGRYwbXx9EQi6D/dICw Date: Fri, 9 Dec 2016 10:20:49 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB048310395E6E93@SHSMSX104.ccr.corp.intel.com> References: <1480574875-12568-1-git-send-email-liming.gao@intel.com> In-Reply-To: <1480574875-12568-1-git-send-email-liming.gao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] MdeModulePkg PiSmmCore: Update FreePages to handle zero address and pages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2016 10:20:54 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Gao, Liming=20 Sent: Thursday, December 1, 2016 2:48 PM To: edk2-devel@lists.01.org Cc: Zeng, Star ; Yao, Jiewen Subject: [Patch] MdeModulePkg PiSmmCore: Update FreePages to handle zero ad= dress and pages https://bugzilla.tianocore.org/show_bug.cgi?id=3D278 Zero memory address or zero number pages are invalid to SmmFreePages(). Cc: Star Zeng Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- MdeModulePkg/Core/PiSmmCore/Page.c | 8 ++++---- MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Core/PiSmmCore/Page.c b/MdeModulePkg/Core/PiSmmCo= re/Page.c index 5f19d7e..1bc8fd8 100644 --- a/MdeModulePkg/Core/PiSmmCore/Page.c +++ b/MdeModulePkg/Core/PiSmmCore/Page.c @@ -861,7 +861,7 @@ InternalMergeNodes ( @param[in] AddRegion If this memory is new added region. =20 @retval EFI_NOT_FOUND Could not find the entry that covers the = range. - @retval EFI_INVALID_PARAMETER Address not aligned. + @retval EFI_INVALID_PARAMETER Address not aligned, Address is zero or N= umberOfPages is zero. @return EFI_SUCCESS Pages successfully freed. =20 **/ @@ -875,7 +875,7 @@ SmmInternalFreePagesEx ( LIST_ENTRY *Node; FREE_PAGE_LIST *Pages; =20 - if ((Memory & EFI_PAGE_MASK) !=3D 0) { + if (((Memory & EFI_PAGE_MASK) !=3D 0) || (Memory =3D=3D 0) || (NumberOfP= ages =3D=3D 0)) { return EFI_INVALID_PARAMETER; } =20 @@ -933,7 +933,7 @@ SmmInternalFreePagesEx ( @param[in] NumberOfPages The number of pages to free. =20 @retval EFI_NOT_FOUND Could not find the entry that covers the = range. - @retval EFI_INVALID_PARAMETER Address not aligned. + @retval EFI_INVALID_PARAMETER Address not aligned, Address is zero or N= umberOfPages is zero. @return EFI_SUCCESS Pages successfully freed. =20 **/ @@ -954,7 +954,7 @@ SmmInternalFreePages ( @param NumberOfPages The number of pages to free. =20 @retval EFI_NOT_FOUND Could not find the entry that covers the = range. - @retval EFI_INVALID_PARAMETER Address not aligned. + @retval EFI_INVALID_PARAMETER Address not aligned, Address is zero or N= umberOfPages is zero. @return EFI_SUCCESS Pages successfully freed. =20 **/ diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.h index e2fee54..9b72ded 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h @@ -312,7 +312,7 @@ SmmInternalAllocatePages ( @param NumberOfPages The number of pages to free =20 @retval EFI_NOT_FOUND Could not find the entry that covers the = range - @retval EFI_INVALID_PARAMETER Address not aligned + @retval EFI_INVALID_PARAMETER Address not aligned, Address is zero or N= umberOfPages is zero. @return EFI_SUCCESS Pages successfully freed. =20 **/ @@ -330,7 +330,7 @@ SmmFreePages ( @param NumberOfPages The number of pages to free =20 @retval EFI_NOT_FOUND Could not find the entry that covers the = range - @retval EFI_INVALID_PARAMETER Address not aligned + @retval EFI_INVALID_PARAMETER Address not aligned, Address is zero or N= umberOfPages is zero. @return EFI_SUCCESS Pages successfully freed. =20 **/ --=20 2.8.0.windows.1