mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/PiSmmCpuDxeSmm: Avoid possible NULL ptr dereference
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>
This commit is contained in:
parent
264914a512
commit
6d9a0a9420
|
@ -1098,7 +1098,7 @@ GetUefiMemoryAttributesTable (
|
||||||
UINTN MemoryAttributesTableSize;
|
UINTN MemoryAttributesTableSize;
|
||||||
|
|
||||||
Status = EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGuid, (VOID **)&MemoryAttributesTable);
|
Status = EfiGetSystemConfigurationTable (&gEfiMemoryAttributesTableGuid, (VOID **)&MemoryAttributesTable);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status) && (MemoryAttributesTable != NULL)) {
|
||||||
MemoryAttributesTableSize = sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + MemoryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntries;
|
MemoryAttributesTableSize = sizeof(EFI_MEMORY_ATTRIBUTES_TABLE) + MemoryAttributesTable->DescriptorSize * MemoryAttributesTable->NumberOfEntries;
|
||||||
mUefiMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable);
|
mUefiMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable);
|
||||||
ASSERT (mUefiMemoryAttributesTable != NULL);
|
ASSERT (mUefiMemoryAttributesTable != NULL);
|
||||||
|
|
Loading…
Reference in New Issue