summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/Dxe
diff options
context:
space:
mode:
authorJian J Wang <jian.j.wang@intel.com>2018-03-07 11:26:32 +0800
committerStar Zeng <star.zeng@intel.com>2018-03-08 12:41:15 +0800
commite6deaf9dbe78aa005961815159f315709b147190 (patch)
tree15523be0b8f05ea09453ace5545f62797b8d4f4d /MdeModulePkg/Core/Dxe
parentbb63309662099061b1f94be39a22c9d33d83e74c (diff)
downloadedk2-e6deaf9dbe78aa005961815159f315709b147190.tar.gz
edk2-e6deaf9dbe78aa005961815159f315709b147190.tar.bz2
edk2-e6deaf9dbe78aa005961815159f315709b147190.zip
MdeModulePkg/Core: fix too many available pages between BS_Data
The root cause is an unnecessary check to Size parameter in function AdjustMemoryS(). It will cause one standalone free page (happen to have Guard page around) in the free memory list cannot be allocated, even if the requested memory size is less than a page. // // At least one more page needed for Guard page. // if (Size < (SizeRequested + EFI_PAGES_TO_SIZE (1))) { return 0; } The following code in the same function actually covers above check implicitly. So the fix is simply removing above check. 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> (cherry picked from commit 8b13bca9b81490fc0e42df25d5feb82bbb47833e)
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/HeapGuard.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
index d7906e08c5..19245049c2 100644
--- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
+++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
@@ -1,7 +1,7 @@
/** @file
UEFI Heap Guard functions.
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017-2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -905,13 +905,6 @@ AdjustMemoryS (
Target = Start + Size - SizeRequested;
- //
- // At least one more page needed for Guard page.
- //
- if (Size < (SizeRequested + EFI_PAGES_TO_SIZE (1))) {
- return 0;
- }
-
if (!IsGuardPage (Start + Size)) {
// No Guard at tail to share. One more page is needed.
Target -= EFI_PAGES_TO_SIZE (1);