Revision: 17183
          http://sourceforge.net/p/edk2/code/17183
Author:   vanjeff
Date:     2015-04-15 06:55:12 +0000 (Wed, 15 Apr 2015)
Log Message:
-----------
SourceLevelDebugPkg: Avoid NULL pointer reference.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff....@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>

Modified Paths:
--------------
    
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c

Modified: 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
===================================================================
--- 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
    2015-04-15 04:46:50 UTC (rev 17182)
+++ 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
    2015-04-15 06:55:12 UTC (rev 17183)
@@ -525,23 +525,24 @@
     if (Mailbox == NULL) {
       DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to allocate memory!\n"));
       CpuDeadLoop ();
+    } else {
+      MailboxLocation = (UINT64)(UINTN)Mailbox;
+      MailboxLocationPointer = BuildGuidDataHob (
+                                 &gEfiDebugAgentGuid,
+                                 &MailboxLocation,
+                                 sizeof (UINT64)
+                                 );
+      //
+      // Initialize Debug Timer hardware and save its frequency
+      //
+      InitializeDebugTimer (&DebugTimerFrequency);
+      UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, 
DebugTimerFrequency);
+      //
+      // Update IDT entry to save the location pointer saved mailbox pointer
+      //
+      SetLocationSavedMailboxPointerInIdtEntry (MailboxLocationPointer);
     }
-    MailboxLocation = (UINT64)(UINTN)Mailbox;
-    MailboxLocationPointer = BuildGuidDataHob (
-                               &gEfiDebugAgentGuid,
-                               &MailboxLocation,
-                               sizeof (UINT64)
-                               );
     //
-    // Initialize Debug Timer hardware and save its frequency
-    //
-    InitializeDebugTimer (&DebugTimerFrequency);
-    UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY, 
DebugTimerFrequency);
-    //
-    // Update IDT entry to save the location pointer saved mailbox pointer
-    //
-    SetLocationSavedMailboxPointerInIdtEntry (MailboxLocationPointer);
-    //
     // Save init arch type when debug agent initialized
     //
     SetDebugFlag (DEBUG_AGENT_FLAG_INIT_ARCH, DEBUG_ARCH_SYMBOL);


------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to