summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c20
-rw-r--r--MdePkg/Include/Library/MemoryAllocationLib.h12
-rw-r--r--MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c20
-rw-r--r--MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c20
4 files changed, 30 insertions, 42 deletions
diff --git a/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c b/MdeModulePkg/Library/DxeCoreMemoryAllocationLib/MemoryAllocationLib.c
index 5939f22..5a51659 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.
diff --git a/MdePkg/Include/Library/MemoryAllocationLib.h b/MdePkg/Include/Library/MemoryAllocationLib.h
index 597aeec..5199e17 100644
--- a/MdePkg/Include/Library/MemoryAllocationLib.h
+++ b/MdePkg/Include/Library/MemoryAllocationLib.h
@@ -390,8 +390,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 NewSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
- If OldSize is greater than (MAX_ADDRESS - Buffer + 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.
@@ -419,8 +419,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 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.
@@ -448,8 +448,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 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.
diff --git a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
index 6e0517f..81b49a6 100644
--- a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
@@ -648,8 +648,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.
@@ -670,10 +670,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));
@@ -692,8 +688,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.
@@ -724,8 +720,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.
@@ -756,8 +752,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.
diff --git a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
index 6683722..2688837 100644
--- a/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/UefiMemoryAllocationLib/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.