diff options
author | Hao Wu <hao.a.wu@intel.com> | 2018-07-30 13:20:13 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2018-07-31 13:07:47 +0800 |
commit | 6d9a0a9420167a87d353b53b93fec17ad61b4b61 (patch) | |
tree | 3d9259daccd17f46d2226917ee80fa231b0417ea /UefiCpuPkg | |
parent | 264914a512f06916aae0e5c292d1f9676ddbbb3d (diff) | |
download | edk2-6d9a0a9420167a87d353b53b93fec17ad61b4b61.zip edk2-6d9a0a9420167a87d353b53b93fec17ad61b4b61.tar.gz edk2-6d9a0a9420167a87d353b53b93fec17ad61b4b61.tar.bz2 |
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>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r-- | UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index 7d99f23..684b14d 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -1098,7 +1098,7 @@ GetUefiMemoryAttributesTable ( UINTN MemoryAttributesTableSize;
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;
mUefiMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable);
ASSERT (mUefiMemoryAttributesTable != NULL);
|