From 8977a7b7b631619347ebfcde1a08174d08a0c7bf Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Fri, 10 Apr 2015 08:52:48 +0000 Subject: SourceLevelDebugPkg: Fix calculate the checksum bug and add NULL pointer check Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Ruiyu Ni git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17160 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent') diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c index b718e82e20..ec389c7e8b 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c +++ b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c @@ -522,6 +522,10 @@ InitializeDebugAgent ( // Build mailbox in HOB and setup Mailbox Set In Pei flag // Mailbox = AllocateZeroPool (sizeof (DEBUG_AGENT_MAILBOX)); + if (Mailbox == NULL) { + DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to allocate memory!\n")); + CpuDeadLoop (); + } MailboxLocation = (UINT64)(UINTN)Mailbox; MailboxLocationPointer = BuildGuidDataHob ( &gEfiDebugAgentGuid, -- cgit v1.2.3