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>
This commit is contained in:
Bret Barkelew 2019-06-12 11:56:29 +08:00 committed by Hao A Wu
parent be5903ad1e
commit 8797683f96
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}