]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Minor update the function interface for three re-allocate pool APIs to check the...
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 12 May 2009 02:29:22 +0000 (02:29 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 12 May 2009 02:29:22 +0000 (02:29 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8296 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
MdePkg/Include/Library/MemoryAllocationLib.h
MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
MdePkg/Library/UefiMemoryAllocationLib/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 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
 \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
   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
   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 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
 \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 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
 \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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
index 597aeecaefd607531b1daa6986654b474f7b91b7..5199e17ce81d6781b31862370d5f056a8bc9b113 100644 (file)
@@ -390,8 +390,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 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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
@@ -419,8 +419,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 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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
@@ -448,8 +448,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 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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
index 6e0517fe4d9087a5f776b6a5b009386a258e8a21..81b49a6b3e29f56f76bdb1d812d074de6954badd 100644 (file)
@@ -648,8 +648,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 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
 \r
   @param  PoolType       The type of pool to allocate.\r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
@@ -670,10 +670,6 @@ InternalReallocatePool (
 {\r
   VOID  *NewBuffer;\r
 \r
 {\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
   NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);\r
   if (NewBuffer != NULL && OldBuffer != NULL) {\r
     CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));\r
@@ -692,8 +688,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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
@@ -724,8 +720,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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
@@ -756,8 +752,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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r
index 668372223cfaeb7c58a63071504ad83f8c93f66f..2688837527dfaf232e7c10bd03cc487271ab5295 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 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
 \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
   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
   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 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
 \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 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
 \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 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
 \r
   @param  OldSize        The size, in bytes, of OldBuffer.\r
   @param  NewSize        The size, in bytes, of the buffer to reallocate.\r