diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-12-20 09:13:23 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-12-20 12:45:26 +0800 |
commit | 403f54768cd517221143064449ac861f0aac4ec5 (patch) | |
tree | 35894658f486d2d69a1e1612a5810a2889be9050 /UefiCpuPkg | |
parent | 4fa9134e47bfb3b7cd9348c8d44fdb029830018b (diff) | |
download | edk2-platforms-403f54768cd517221143064449ac861f0aac4ec5.tar.xz |
UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr dereference
Contributed-under: TianoCore Contribution Agreement 1.0
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 | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index f4716f3433..13323d5409 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -1011,6 +1011,10 @@ GetUefiMemoryMap ( }
} while (Status == EFI_BUFFER_TOO_SMALL);
+ if (MemoryMap == NULL) {
+ return ;
+ }
+
SortMemoryMap (MemoryMap, UefiMemoryMapSize, mUefiDescriptorSize);
MergeMemoryMapForNotPresentEntry (MemoryMap, &UefiMemoryMapSize, mUefiDescriptorSize);
@@ -1080,6 +1084,10 @@ IsSmmCommBufferForbiddenAddress ( UINTN MemoryMapEntryCount;
UINTN Index;
+ if (mUefiMemoryMap == NULL) {
+ return FALSE;
+ }
+
MemoryMap = mUefiMemoryMap;
MemoryMapEntryCount = mUefiMemoryMapSize/mUefiDescriptorSize;
for (Index = 0; Index < MemoryMapEntryCount; Index++) {
|