summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-08 22:10:26 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-08 22:10:26 +0000
commitae55f4ebda86f470c82c8b19346005338522aeef (patch)
tree8f81fd2c18ae3138b4dcdce012271696595ffea2 /MdeModulePkg/Library
parent6babbe1f8cfe5b7e7657e0c14045bff608b6b04c (diff)
downloadedk2-platforms-ae55f4ebda86f470c82c8b19346005338522aeef.tar.xz
Fix bug in Reallocate Pool functions in DXE Core Memory Allocation Lib. The wrong memory type was being allocated. This syncs the DXE Core 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@8270 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c b/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
index 7f15ec0be9..2f96468cac 100644
--- a/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
@@ -661,9 +661,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 OldBuffer is NULL, then ASSERT().
- If NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
- If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+ If 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.
@@ -684,7 +683,7 @@ InternalReallocatePool (
{
VOID *NewBuffer;
- NewBuffer = AllocateZeroPool (NewSize);
+ NewBuffer = InternalAllocateZeroPool (PoolType, NewSize);
if (NewBuffer != NULL && OldBuffer != NULL) {
CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
FreePool (OldBuffer);
@@ -702,8 +701,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 NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
- If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+ If 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.
@@ -734,8 +733,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 NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
- If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+ If 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.
@@ -766,8 +765,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 NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
- If OldSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+ If 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.