]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Initialize the local variable before refer to them.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 12 Jun 2010 03:14:26 +0000 (03:14 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 12 Jun 2010 03:14:26 +0000 (03:14 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10577 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c
EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c
EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Io.c

index 03b66623c94132a3ea602b52e645b1dfebe1024c..91f3aaffb5a9ab44c8999c7cfa3f626ab9f7db03 100644 (file)
@@ -188,6 +188,7 @@ Returns:
   //\r
   // For now, allocate an arbitrarily long buffer\r
   //\r
+  BufferLen = 0;\r
   Buffer = EfiLibAllocateZeroPool (0x10000);\r
   if (Buffer == NULL) {\r
     return 0;\r
@@ -428,14 +429,15 @@ Returns:
 \r
   Handle = gST->ConsoleOutHandle;\r
 \r
+  GraphicsOutput = NULL;\r
+  UgaDraw        = NULL;\r
   Status = gBS->HandleProtocol (\r
                   Handle,\r
                   &gEfiGraphicsOutputProtocolGuid,\r
                   (VOID**)&GraphicsOutput\r
                   );\r
 \r
-  UgaDraw = NULL;\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || (GraphicsOutput == NULL)) {\r
     GraphicsOutput = NULL;\r
 \r
     Status = gBS->HandleProtocol (\r
index 5b815e610e452bfaf6e38cca352e2ccf678b3666..0988cc2f30bab7421a99fc2c7f45413cf7162720 100644 (file)
@@ -155,6 +155,7 @@ Returns:
   //\r
   // For now, allocate an arbitrarily long buffer\r
   //\r
+  BufferLen = 0;\r
   Buffer = EfiLibAllocateZeroPool (0x10000);\r
   if (Buffer == NULL) {\r
     return 0;\r
@@ -394,14 +395,15 @@ Returns:
 \r
   Handle = gST->ConsoleOutHandle;\r
 \r
+  GraphicsOutput = NULL;\r
+  UgaDraw = NULL;\r
   Status = gBS->HandleProtocol (\r
                   Handle,\r
                   &gEfiGraphicsOutputProtocolGuid,\r
                   (VOID **) &GraphicsOutput\r
                   );\r
 \r
-  UgaDraw = NULL;\r
-  if (EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status) || (GraphicsOutput == NULL)) {\r
     GraphicsOutput = NULL;\r
 \r
     Status = gBS->HandleProtocol (\r
@@ -410,7 +412,7 @@ Returns:
                     (VOID **) &UgaDraw\r
                     );\r
 \r
-    if (EFI_ERROR (Status) || (UgaDraw != NULL)) {\r
+    if (EFI_ERROR (Status) || (UgaDraw == NULL)) {\r
       return 0;\r
     }\r
   }\r
@@ -422,7 +424,7 @@ Returns:
                   (VOID **) &Sto\r
                   );\r
 \r
-  if (EFI_ERROR (Status) || (Sto != NULL)) {\r
+  if (EFI_ERROR (Status) || (Sto == NULL)) {\r
     return 0;\r
   }\r
 \r
index 30ec41769edc1751afc97245bfcfd3687282a669..cc491238fe5a61f8d628f7b7efa75f8db0ef1a1a 100644 (file)
@@ -155,7 +155,7 @@ GlueMakeTable (
   //\r
   // TableBits should not be greater than 16.\r
   //\r
-  if (TableBits >= (sizeof (Count)/sizeof (UINT16))) {\r
+  if (TableBits > 16) {\r
     return (UINT16) BAD_TABLE;\r
   }\r
  \r
@@ -170,7 +170,7 @@ GlueMakeTable (
     //\r
     // Count array index should not be greater than or equal to its size.\r
     //\r
-    if (BitLen[Index] < (sizeof (Count)/sizeof (UINT16))) {\r
+    if (BitLen[Index] <= 16) {\r
       Count[BitLen[Index]]++;\r
     } else {\r
       return (UINT16) BAD_TABLE;\r
index f73323cf5f9ea82a868f6f71834c7f75c14d8442..2a52906fc19bc09be8304ba9a24f531aaa3f9e3a 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2010, 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
@@ -42,6 +42,7 @@ Returns:
 {\r
   UINT8 Buffer;\r
 \r
+  Buffer = 0;\r
   EfiIoRead (EfiCpuIoWidthUint8, Address, 1, &Buffer);\r
   return Buffer;\r
 }\r
@@ -65,6 +66,7 @@ Returns:
 {\r
   UINT16  Buffer;\r
 \r
+  Buffer = 0;\r
   EfiIoRead (EfiCpuIoWidthUint16, Address, 1, &Buffer);\r
   return Buffer;\r
 }\r
@@ -88,6 +90,7 @@ Returns:
 {\r
   UINT32  Buffer;\r
 \r
+  Buffer = 0;\r
   EfiIoRead (EfiCpuIoWidthUint32, Address, 1, &Buffer);\r
   return Buffer;\r
 }\r
@@ -177,6 +180,7 @@ Returns:
 {\r
   UINT8   Buffer;\r
 \r
+  Buffer = 0;\r
   EfiMemRead (EfiCpuIoWidthUint8, Address, 1, &Buffer);\r
   return Buffer;\r
 }\r
@@ -200,6 +204,7 @@ Returns:
 {\r
   UINT16  Buffer;\r
 \r
+  Buffer = 0;\r
   EfiMemRead (EfiCpuIoWidthUint16, Address, 1, &Buffer);\r
   return Buffer;\r
 }\r
@@ -223,6 +228,7 @@ Returns:
 {\r
   UINT32  Buffer;\r
 \r
+  Buffer = 0;\r
   EfiMemRead (EfiCpuIoWidthUint32, Address, 1, &Buffer);\r
   return Buffer;\r
 }\r
@@ -246,6 +252,7 @@ Returns:
 {\r
   UINT64  Buffer;\r
 \r
+  Buffer = 0;\r
   EfiMemRead (EfiCpuIoWidthUint64, Address, 1, &Buffer);\r
   return Buffer;\r
 }\r