]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
Minor update the function interface for three re-allocate pool APIs to check the...
[mirror_edk2.git] / MdeModulePkg / Library / DxeCoreMemoryAllocationLib / MemoryAllocationLib.c
index 5939f2278c1a2cf5168aa0b20658224c3cfb4582..5a51659893729cc89cbb3592286f8d896b6a6882 100644 (file)
@@ -663,8 +663,8 @@ AllocateReservedCopyPool (
   If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
   enough memory remaining to satisfy the request, then NULL is returned.\r
   \r
-  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
-  then ASSERT(). \r
+  If the allocation of the new buffer is successful and the smaller of NewSize and OldSize\r
+  is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  PoolType       The type of pool to allocate.\r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
@@ -685,10 +685,6 @@ InternalReallocatePool (
 {\r
   VOID  *NewBuffer;\r
 \r
-  //\r
-  // Check the boundary for OldBuffer even if the allocation failure.\r
-  //\r
-  ASSERT (OldBuffer == NULL || MIN (OldSize, NewSize) <= MAX_ADDRESS - (UINTN) OldBuffer + 1);\r
   NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);\r
   if (NewBuffer != NULL && OldBuffer != NULL) {\r
     CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));\r
@@ -707,8 +703,8 @@ InternalReallocatePool (
   If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
   enough memory remaining to satisfy the request, then NULL is returned.\r
   \r
-  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
-  then ASSERT(). \r
+  If the allocation of the new buffer is successful and the smaller of NewSize and OldSize\r
+  is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
@@ -739,8 +735,8 @@ ReallocatePool (
   If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
   enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
-  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
-  then ASSERT(). \r
+  If the allocation of the new buffer is successful and the smaller of NewSize and OldSize\r
+  is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
@@ -771,8 +767,8 @@ ReallocateRuntimePool (
   If NewSize is 0, then a valid buffer of 0 size is  returned.  If there is not \r
   enough memory remaining to satisfy the request, then NULL is returned.\r
 \r
-  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
-  then ASSERT(). \r
+  If the allocation of the new buffer is successful and the smaller of NewSize and OldSize\r
+  is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().\r
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r