From 8797683f96a1909d74488e19d1bae96228aa3f66 Mon Sep 17 00:00:00 2001 From: Bret Barkelew Date: Wed, 12 Jun 2019 11:56:29 +0800 Subject: [PATCH] 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 Cc: Ray Ni Cc: Star Zeng Cc: Liming Gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao Reviewed-by: Liming Gao Acked-by: Hao A Wu --- MdeModulePkg/Core/Pei/Memory/MemoryServices.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; }