]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Clarify ASSERT() conditions for Reallocate Pool functions.
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 May 2009 22:09:40 +0000 (22:09 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 May 2009 22:09:40 +0000 (22:09 +0000)
Fix bug in Reallocate Pool functions in PEI Memory Allocation Lib.  The wrong memory type was being allocated.  This syncs the PEI Memory Allocation Lib with the fix that was previously made to the UEFI Memory Allocation Lib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8269 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c

index a240d03ef348073967ecf61a0abf4a6f161642d3..f9e723ef2f1ac3cb44cf960f9bb9cbc46d5a32ee 100644 (file)
@@ -644,8 +644,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 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
@@ -666,7 +666,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
@@ -684,8 +684,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
@@ -716,8 +716,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
@@ -748,8 +748,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
index 1cf829babb7e41c0f72c1b9e5398163fdf4297ee..2a9f128424fa46cffb6c3167097962a6bb01a1c4 100644 (file)
@@ -661,8 +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 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
@@ -701,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
@@ -733,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
@@ -765,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