]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
UefiLib:
[mirror_edk2.git] / MdePkg / Library / PeiMemoryAllocationLib / MemoryAllocationLib.c
index 274287cf035e216cc537f3c6aff59750efcac32a..59e9a262386ed5d779685e51d53ad86960ab3343 100644 (file)
@@ -451,6 +451,9 @@ InternalAllocateCopyPool (
 {\r
   VOID  *Memory;\r
 \r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
+\r
   Memory = InternalAllocatePool (PoolType, AllocationSize);\r
   if (Memory != NULL) {\r
      Memory = CopyMem (Memory, Buffer, AllocationSize);\r
@@ -477,6 +480,9 @@ AllocateCopyPool (
 {\r
   VOID  *Memory;\r
 \r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
+\r
   Memory = AllocatePool (AllocationSize);\r
   if (Memory != NULL) {\r
      Memory = CopyMem (Memory, Buffer, AllocationSize);\r
@@ -791,6 +797,9 @@ InternalAllocateAlignedCopyPool (
 {\r
   VOID  *Memory;\r
   \r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
+\r
   Memory = InternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);\r
   if (Memory != NULL) {\r
     Memory = CopyMem (Memory, Buffer, AllocationSize);\r
@@ -820,6 +829,9 @@ AllocateAlignedCopyPool (
 {\r
   VOID  *Memory;\r
   \r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
+\r
   Memory = AllocateAlignedPool (AllocationSize, Alignment);\r
   if (Memory != NULL) {\r
     Memory = CopyMem (Memory, Buffer, AllocationSize);\r