]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine code to make it more safely.
authorEric Dong <eric.dong@intel.com>
Wed, 25 Jun 2014 06:49:53 +0000 (06:49 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 25 Jun 2014 06:49:53 +0000 (06:49 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15591 6f19259b-4bc3-4df7-8a09-765794883524

SourceLevelDebugPkg/DebugAgentDxe/DebugAgentDxe.c
SourceLevelDebugPkg/DebugAgentPei/DebugAgentPei.c
SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c

index 99bb2fdedbf0556417c89180f0726885a74d17b2..80d997bc95cb4830ea90377f01e1231e9da017c5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Initialize Debug Agent in DXE by invoking Debug Agent Library.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -58,6 +58,7 @@ DebugAgentDxeInitialize(
 {\r
   EFI_STATUS      Status;\r
 \r
+  Status = EFI_UNSUPPORTED;\r
   InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_LOAD, &Status, NULL);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -95,6 +96,7 @@ DebugAgentDxeUnload (
 {\r
   EFI_STATUS          Status;\r
 \r
+  Status = EFI_UNSUPPORTED;\r
   InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_UNLOAD, &Status, NULL);\r
 \r
   return Status;\r
index df0ac87b421d9ab914865d34e0fdb22b171cf833..2dcc7a78d16ad8a1867631b6abec33d0f66f6611 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Initialize Debug Agent in PEI by invoking Debug Agent Library.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -39,6 +39,7 @@ DebugAgentPeiInitialize (
 {\r
   EFI_STATUS                 Status;\r
 \r
+  Status = EFI_UNSUPPORTED;\r
   InitializeDebugAgent (DEBUG_AGENT_INIT_PEI, &Status, NULL);\r
 \r
   return Status;\r
index 95306e5759e767d0d62980013af24c4f80555f42..48bc38ca547cbb6fa1eb47477c23962899bde3b1 100644 (file)
@@ -587,7 +587,7 @@ ReadRemainingBreakPacket (
   //\r
   // Has received start symbol, try to read the rest part\r
   //\r
-  if (DebugPortReadBuffer (Handle, &DebugHeader->Command, sizeof (DEBUG_PACKET_HEADER) - 1, READ_PACKET_TIMEOUT) == 0) {\r
+  if (DebugPortReadBuffer (Handle, (UINT8 *)DebugHeader + OFFSET_OF (DEBUG_PACKET_HEADER, Command), sizeof (DEBUG_PACKET_HEADER) - OFFSET_OF (DEBUG_PACKET_HEADER, Command), READ_PACKET_TIMEOUT) == 0) {\r
     //\r
     // Timeout occur, exit\r
     //\r
@@ -1014,7 +1014,7 @@ ReceivePacket (
     //\r
     Received = DebugPortReadBuffer (\r
                  Handle,\r
-                 &DebugHeader->Command,\r
+                 (UINT8 *)DebugHeader + OFFSET_OF (DEBUG_PACKET_HEADER, Command),\r
                  OFFSET_OF (DEBUG_PACKET_HEADER, Length) + sizeof (DebugHeader->Length) - sizeof (DebugHeader->StartSymbol),\r
                  Timeout\r
                  );\r
@@ -2104,6 +2104,7 @@ InterruptProcess (
   UINT32                           IssuedViewPoint;\r
   DEBUG_AGENT_EXCEPTION_BUFFER     *ExceptionBuffer;\r
 \r
+  InputCharacter  = 0;\r
   ProcessorIndex  = 0;\r
   IssuedViewPoint = 0;\r
   BreakReceived   = FALSE;\r