diff options
Diffstat (limited to 'MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c')
-rw-r--r-- | MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c index 274287cf03..59e9a26238 100644 --- a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c +++ b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c @@ -451,6 +451,9 @@ InternalAllocateCopyPool ( {
VOID *Memory;
+ ASSERT (Buffer != NULL);
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+
Memory = InternalAllocatePool (PoolType, AllocationSize);
if (Memory != NULL) {
Memory = CopyMem (Memory, Buffer, AllocationSize);
@@ -477,6 +480,9 @@ AllocateCopyPool ( {
VOID *Memory;
+ ASSERT (Buffer != NULL);
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+
Memory = AllocatePool (AllocationSize);
if (Memory != NULL) {
Memory = CopyMem (Memory, Buffer, AllocationSize);
@@ -791,6 +797,9 @@ InternalAllocateAlignedCopyPool ( {
VOID *Memory;
+ ASSERT (Buffer != NULL);
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+
Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);
if (Memory != NULL) {
Memory = CopyMem (Memory, Buffer, AllocationSize);
@@ -820,6 +829,9 @@ AllocateAlignedCopyPool ( {
VOID *Memory;
+ ASSERT (Buffer != NULL);
+ ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
+
Memory = AllocateAlignedPool (AllocationSize, Alignment);
if (Memory != NULL) {
Memory = CopyMem (Memory, Buffer, AllocationSize);
|