mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
4fa9134e47
commit
403f54768c
|
@ -1011,6 +1011,10 @@ GetUefiMemoryMap (
|
||||||
}
|
}
|
||||||
} while (Status == EFI_BUFFER_TOO_SMALL);
|
} while (Status == EFI_BUFFER_TOO_SMALL);
|
||||||
|
|
||||||
|
if (MemoryMap == NULL) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
SortMemoryMap (MemoryMap, UefiMemoryMapSize, mUefiDescriptorSize);
|
SortMemoryMap (MemoryMap, UefiMemoryMapSize, mUefiDescriptorSize);
|
||||||
MergeMemoryMapForNotPresentEntry (MemoryMap, &UefiMemoryMapSize, mUefiDescriptorSize);
|
MergeMemoryMapForNotPresentEntry (MemoryMap, &UefiMemoryMapSize, mUefiDescriptorSize);
|
||||||
|
|
||||||
|
@ -1080,6 +1084,10 @@ IsSmmCommBufferForbiddenAddress (
|
||||||
UINTN MemoryMapEntryCount;
|
UINTN MemoryMapEntryCount;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
|
if (mUefiMemoryMap == NULL) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
MemoryMap = mUefiMemoryMap;
|
MemoryMap = mUefiMemoryMap;
|
||||||
MemoryMapEntryCount = mUefiMemoryMapSize/mUefiDescriptorSize;
|
MemoryMapEntryCount = mUefiMemoryMapSize/mUefiDescriptorSize;
|
||||||
for (Index = 0; Index < MemoryMapEntryCount; Index++) {
|
for (Index = 0; Index < MemoryMapEntryCount; Index++) {
|
||||||
|
|
Loading…
Reference in New Issue