summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-12 02:29:22 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-12 02:29:22 +0000
commit56304569090565f5b8a24c365de38f47c7b0217c (patch)
tree4a3cc4ffda09c2b41226cba842774590e4ef4e15 /MdeModulePkg/Library
parentd2b4564ba50b095d5a5e00b9c7bebef004967d5e (diff)
downloadedk2-platforms-56304569090565f5b8a24c365de38f47c7b0217c.tar.xz
Minor update the function interface for three re-allocate pool APIs to check the conformance of OldBuffer only when the memory allocation succeeds. In this way the assert condition is covered by CopyMem () API in BaseMemoryLib.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8296 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c b/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
index 5939f2278c..5a51659893 100644
--- a/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
@@ -663,8 +663,8 @@ AllocateReservedCopyPool (
If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
enough memory remaining to satisfy the request, then NULL is returned.
- If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),
- then ASSERT().
+ If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
+ is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
@param PoolType The type of pool to allocate.
@param OldSize The size, in bytes, of OldBuffer.
@@ -685,10 +685,6 @@ InternalReallocatePool (
{
VOID *NewBuffer;
- //
- // Check the boundary for OldBuffer even if the allocation failure.
- //
- ASSERT (OldBuffer == NULL || MIN (OldSize, NewSize) <= MAX_ADDRESS - (UINTN) OldBuffer + 1);
NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
if (NewBuffer != NULL && OldBuffer != NULL) {
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
@@ -707,8 +703,8 @@ InternalReallocatePool (
If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
enough memory remaining to satisfy the request, then NULL is returned.
- If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),
- then ASSERT().
+ If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
+ is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
@param OldSize The size, in bytes, of OldBuffer.
@param NewSize The size, in bytes, of the buffer to reallocate.
@@ -739,8 +735,8 @@ ReallocatePool (
If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
enough memory remaining to satisfy the request, then NULL is returned.
- If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),
- then ASSERT().
+ If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
+ is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
@param OldSize The size, in bytes, of OldBuffer.
@param NewSize The size, in bytes, of the buffer to reallocate.
@@ -771,8 +767,8 @@ ReallocateRuntimePool (
If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
enough memory remaining to satisfy the request, then NULL is returned.
- If the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1),
- then ASSERT().
+ If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
+ is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
@param OldSize The size, in bytes, of OldBuffer.
@param NewSize The size, in bytes, of the buffer to reallocate.