summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core
diff options
context:
space:
mode:
authorBret Barkelew <Bret.Barkelew@microsoft.com>2019-06-12 11:56:29 +0800
committerHao A Wu <hao.a.wu@intel.com>2019-06-24 10:18:04 +0800
commit8797683f96a1909d74488e19d1bae96228aa3f66 (patch)
tree32e6a374ffc698465f41140e50542e4814aba682 /MdeModulePkg/Core
parentbe5903ad1e244cbb0930161fb361ed0b699c4cb8 (diff)
downloadedk2-8797683f96a1909d74488e19d1bae96228aa3f66.tar.gz
edk2-8797683f96a1909d74488e19d1bae96228aa3f66.tar.bz2
edk2-8797683f96a1909d74488e19d1bae96228aa3f66.zip
MdeModulePkg/PeiMain: PeiAllocatePool: output NULL if HOB creation fails
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1901 The original logic is ASSERT if fail to create HOB. But that doesn't make sense for release version. So it is required to set the Buffer to null to indicate the failure. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Acked-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r--MdeModulePkg/Core/Pei/Memory/MemoryServices.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
index 42f79ab076..706837890f 100644
--- a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
+++ b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
@@ -802,7 +802,12 @@ PeiAllocatePool (
(VOID **)&Hob
);
ASSERT_EFI_ERROR (Status);
- *Buffer = Hob+1;
+
+ if (EFI_ERROR (Status)) {
+ *Buffer = NULL;
+ } else {
+ *Buffer = Hob + 1;
+ }
return Status;
}