summaryrefslogtreecommitdiffstats
path: root/SourceLevelDebugPkg
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2015-04-10 08:52:48 +0000
committervanjeff <vanjeff@Edk2>2015-04-10 08:52:48 +0000
commit8977a7b7b631619347ebfcde1a08174d08a0c7bf (patch)
tree187918bfcffde8424606629c96a347b46f4c9cad /SourceLevelDebugPkg
parent1ae469b9ed59306f43419e2beb4a547399c096ac (diff)
downloadedk2-8977a7b7b631619347ebfcde1a08174d08a0c7bf.tar.gz
edk2-8977a7b7b631619347ebfcde1a08174d08a0c7bf.tar.bz2
edk2-8977a7b7b631619347ebfcde1a08174d08a0c7bf.zip
SourceLevelDebugPkg: Fix calculate the checksum bug and add NULL pointer check
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17160 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c2
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
index fc40112b54..42b73f60ea 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
@@ -381,7 +381,7 @@ UpdateMailboxContent (
Mailbox->HostSequenceNo = (UINT8) Value;
break;
case DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY:
- Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 *)&Mailbox->HostSequenceNo, sizeof(UINT32))
+ Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 *)&Mailbox->DebugTimerFrequency, sizeof(UINT32))
- CalculateSum8 ((UINT8 *)&Value, sizeof(UINT32));
Mailbox->DebugTimerFrequency = (UINT32) Value;
break;
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,