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:09:29 +0800 |
commit | 4db69b4470b99b987e5f73ebb63098f382f1a2ab (patch) | |
tree | 0de67766ff596f24a0ea5cfdd448fca027568c95 /MdePkg/Library/SmmMemLib/SmmMemLib.c | |
parent | 9e1e332a0b75b255a75f78e96042004259b50bb6 (diff) | |
download | edk2-4db69b4470b99b987e5f73ebb63098f382f1a2ab.tar.gz edk2-4db69b4470b99b987e5f73ebb63098f382f1a2ab.tar.bz2 edk2-4db69b4470b99b987e5f73ebb63098f382f1a2ab.zip |
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>
(cherry picked from commit 264914a512f06916aae0e5c292d1f9676ddbbb3d)
Diffstat (limited to 'MdePkg/Library/SmmMemLib/SmmMemLib.c')
-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 b401856af4..8c987b9e30 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);
|