MdeModulePkg/PiSmmCore: fix mem alloc issues in heap guard

This patch fixes the same issues in Heap Guard in DXE core, which is fixed
in another patch.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Jian J Wang 2018-03-13 16:29:51 +08:00 committed by Star Zeng
parent dd12683e1f
commit 12957e56d2
1 changed files with 6 additions and 2 deletions

View File

@ -251,8 +251,8 @@ FindGuardedMemoryMap (
//
// Adjust current map table depth according to the address to access
//
while (mMapLevel < GUARDED_HEAP_MAP_TABLE_DEPTH
&&
while (AllocMapUnit &&
mMapLevel < GUARDED_HEAP_MAP_TABLE_DEPTH &&
RShiftU64 (
Address,
mLevelShift[GUARDED_HEAP_MAP_TABLE_DEPTH - mMapLevel - 1]
@ -887,6 +887,10 @@ AdjustMemoryS (
}
Target = Start + Size - SizeRequested;
ASSERT (Target >= Start);
if (Target == 0) {
return 0;
}
if (!IsGuardPage (Start + Size)) {
// No Guard at tail to share. One more page is needed.