]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/SmmMemLib/SmmMemLib.c
MdePkg/SmmMemLib: Avoid possible NULL ptr dereference
[mirror_edk2.git] / MdePkg / Library / SmmMemLib / SmmMemLib.c
index 3409ddf87c8d4d88af98a0b3cfbeaf070085f375..3987af1eba6ad07848e506e985afffc093113241 100644 (file)
@@ -439,7 +439,7 @@ SmmMemLibInternalGetUefiMemoryAttributesTable (
   UINTN                        MemoryAttributesTableSize;\r
 \r
   Status = EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGuid, (VOID **)&MemoryAttributesTable);\r
-  if (!EFI_ERROR (Status)) {\r
+  if (!EFI_ERROR (Status) && (MemoryAttributesTable != NULL)) {\r
     MemoryAttributesTableSize = sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + MemoryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntries;\r
     mSmmMemLibMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable);\r
     ASSERT (mSmmMemLibMemoryAttributesTable != NULL);\r