UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling

ASSERT() is not proper handling of allocation failures, it gets compiled
out on RELEASE builds.  Print a message and enter dead loop instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Gerd Hoffmann 2023-03-10 20:48:49 +08:00 committed by mergify[bot]
parent 2e71876081
commit 4f441d024b
1 changed files with 6 additions and 0 deletions

View File

@ -879,6 +879,12 @@ PiCpuSmmEntry (
// //
BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberOfCpus - 1)); BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberOfCpus - 1));
Buffer = AllocateAlignedCodePages (BufferPages, SIZE_4KB); Buffer = AllocateAlignedCodePages (BufferPages, SIZE_4KB);
if (Buffer == NULL) {
DEBUG ((DEBUG_ERROR, "Failed to allocate %d pages.\n", BufferPages));
CpuDeadLoop ();
return EFI_OUT_OF_RESOURCES;
}
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
DEBUG ((DEBUG_INFO, "New Allcoated SMRAM SaveState Buffer (0x%08x, 0x%08x)\n", Buffer, EFI_PAGES_TO_SIZE (BufferPages))); DEBUG ((DEBUG_INFO, "New Allcoated SMRAM SaveState Buffer (0x%08x, 0x%08x)\n", Buffer, EFI_PAGES_TO_SIZE (BufferPages)));
} }