diff options
author | Hao Wu <hao.a.wu@intel.com> | 2018-07-30 13:17:31 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2018-07-31 13:07:44 +0800 |
commit | 264914a512f06916aae0e5c292d1f9676ddbbb3d (patch) | |
tree | d5532347e1ed27c818e7e15deb91958fdb4b0b7f /MdePkg | |
parent | 39f0156fce373c0c0a04d85928b7d8761037134e (diff) | |
download | edk2-264914a512f06916aae0e5c292d1f9676ddbbb3d.tar.gz |
MdePkg/SmmMemLib: Avoid possible NULL ptr dereference
Within function SmmMemLibInternalGetUefiMemoryAttributesTable(), 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 'MdePkg')
-rw-r--r-- | MdePkg/Library/SmmMemLib/SmmMemLib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/MdePkg/Library/SmmMemLib/SmmMemLib.c b/MdePkg/Library/SmmMemLib/SmmMemLib.c index 3409ddf87c..3987af1eba 100644 --- a/MdePkg/Library/SmmMemLib/SmmMemLib.c +++ b/MdePkg/Library/SmmMemLib/SmmMemLib.c @@ -439,7 +439,7 @@ SmmMemLibInternalGetUefiMemoryAttributesTable ( 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;
mSmmMemLibMemoryAttributesTable = AllocateCopyPool (MemoryAttributesTableSize, MemoryAttributesTable);
ASSERT (mSmmMemLibMemoryAttributesTable != NULL);
|