]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/Page.c
MdeModulePkg PiSmmCore: Update FreePages to handle zero address and pages
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / Page.c
index 5f19d7e6c911343e3c0ed2fc3ddaf6d7d7d16888..1bc8fd82c86713b935420fbb5ef76e4def331354 100644 (file)
@@ -861,7 +861,7 @@ InternalMergeNodes (
   @param[in]  AddRegion              If this memory is new added region.\r
 \r
   @retval EFI_NOT_FOUND          Could not find the entry that covers the range.\r
-  @retval EFI_INVALID_PARAMETER  Address not aligned.\r
+  @retval EFI_INVALID_PARAMETER  Address not aligned, Address is zero or NumberOfPages is zero.\r
   @return EFI_SUCCESS            Pages successfully freed.\r
 \r
 **/\r
@@ -875,7 +875,7 @@ SmmInternalFreePagesEx (
   LIST_ENTRY      *Node;\r
   FREE_PAGE_LIST  *Pages;\r
 \r
-  if ((Memory & EFI_PAGE_MASK) != 0) {\r
+  if (((Memory & EFI_PAGE_MASK) != 0) || (Memory == 0) || (NumberOfPages == 0)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -933,7 +933,7 @@ SmmInternalFreePagesEx (
   @param[in]  NumberOfPages          The number of pages to free.\r
 \r
   @retval EFI_NOT_FOUND          Could not find the entry that covers the range.\r
-  @retval EFI_INVALID_PARAMETER  Address not aligned.\r
+  @retval EFI_INVALID_PARAMETER  Address not aligned, Address is zero or NumberOfPages is zero.\r
   @return EFI_SUCCESS            Pages successfully freed.\r
 \r
 **/\r
@@ -954,7 +954,7 @@ SmmInternalFreePages (
   @param  NumberOfPages          The number of pages to free.\r
 \r
   @retval EFI_NOT_FOUND          Could not find the entry that covers the range.\r
-  @retval EFI_INVALID_PARAMETER  Address not aligned.\r
+  @retval EFI_INVALID_PARAMETER  Address not aligned, Address is zero or NumberOfPages is zero.\r
   @return EFI_SUCCESS            Pages successfully freed.\r
 \r
 **/\r