]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix bug in Reallocate Pool functions in DXE Core Memory Allocation Lib. The wrong...
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 May 2009 22:10:26 +0000 (22:10 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 May 2009 22:10:26 +0000 (22:10 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8270 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c

index 7f15ec0be906401879f503dd3ac371606e093388..2f96468cac7526cad572964e2b943c12d8a2417b 100644 (file)
@@ -661,9 +661,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 OldBuffer is NULL, then ASSERT().\r
-  If NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
-  If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
+  then ASSERT(). \r
 \r
   @param  PoolType       The type of pool to allocate.\r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
@@ -684,7 +683,7 @@ InternalReallocatePool (
 {\r
   VOID  *NewBuffer;\r
 \r
-  NewBuffer = AllocateZeroPool (NewSize);\r
+  NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);\r
   if (NewBuffer != NULL && OldBuffer != NULL) {\r
     CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));\r
     FreePool (OldBuffer);\r
@@ -702,8 +701,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 NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
-  If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
+  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
@@ -734,8 +733,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 NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
-  If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
+  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
@@ -766,8 +765,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 NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
-  If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
+  If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),\r
+  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