]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference
authorHao Wu <hao.a.wu@intel.com>
Mon, 30 Jul 2018 05:20:13 +0000 (13:20 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 31 Jul 2018 05:07:47 +0000 (13:07 +0800)
Within function GetUefiMemoryAttributesTable(), add a check to avoid
possible null pointer dereference.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c

index 7d99f2342657a99de72b65d5018d9ec550f33bb4..684b14dc285e6286b567613debafe911d050d4da 100644 (file)
@@ -1098,7 +1098,7 @@ GetUefiMemoryAttributesTable (
   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
     mUefiMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable);\r
     ASSERT (mUefiMemoryAttributesTable != NULL);\r