]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DynamicTablesPkg: IORT: Fix uninitialized memory usage
authorSami Mujawar <sami.mujawar@arm.com>
Mon, 5 Aug 2019 15:30:38 +0000 (16:30 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 29 Mar 2020 16:53:35 +0000 (16:53 +0000)
On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.

This warning is reported as some variables that were
being logged were uninitialised. To fix this, moved
the logging code after the variables being logged are
initialised.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c

index bd71220ca19679792de2bb6d88eed8d1913a7600..65d006c89e668c8b2b8a14326cddf1b69979597f 100644 (file)
@@ -1738,6 +1738,14 @@ BuildIortTable (
       goto error_handler;\r
     }\r
     TableSize += NodeSize;\r
+\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " ItsGroupNodeCount = %d\n" \\r
+      " ItsGroupOffset = %d\n",\r
+      ItsGroupNodeCount,\r
+      ItsGroupOffset\r
+      ));\r
   }\r
 \r
   // Named Component Nodes\r
@@ -1760,6 +1768,14 @@ BuildIortTable (
       goto error_handler;\r
     }\r
     TableSize += NodeSize;\r
+\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " NamedComponentNodeCount = %d\n" \\r
+      " NamedComponentOffset = %d\n",\r
+      NamedComponentNodeCount,\r
+      NamedComponentOffset\r
+      ));\r
   }\r
 \r
   // Root Complex Nodes\r
@@ -1782,6 +1798,14 @@ BuildIortTable (
       goto error_handler;\r
     }\r
     TableSize += NodeSize;\r
+\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " RootComplexNodeCount = %d\n" \\r
+      " RootComplexOffset = %d\n",\r
+      RootComplexNodeCount,\r
+      RootComplexOffset\r
+      ));\r
   }\r
 \r
   // SMMUv1/SMMUv2 Nodes\r
@@ -1804,6 +1828,14 @@ BuildIortTable (
       goto error_handler;\r
     }\r
     TableSize += NodeSize;\r
+\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " SmmuV1V2NodeCount = %d\n" \\r
+      " SmmuV1V2Offset = %d\n",\r
+      SmmuV1V2NodeCount,\r
+      SmmuV1V2Offset\r
+      ));\r
   }\r
 \r
   // SMMUv3 Nodes\r
@@ -1826,6 +1858,14 @@ BuildIortTable (
       goto error_handler;\r
     }\r
     TableSize += NodeSize;\r
+\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " SmmuV3NodeCount = %d\n" \\r
+      " SmmuV3Offset = %d\n",\r
+      SmmuV3NodeCount,\r
+      SmmuV3Offset\r
+      ));\r
   }\r
 \r
   // PMCG Nodes\r
@@ -1848,6 +1888,14 @@ BuildIortTable (
       goto error_handler;\r
     }\r
     TableSize += NodeSize;\r
+\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " PmcgNodeCount = %d\n" \\r
+      " PmcgOffset = %d\n",\r
+      PmcgNodeCount,\r
+      PmcgOffset\r
+      ));\r
   }\r
 \r
   DEBUG ((\r
@@ -1859,54 +1907,6 @@ BuildIortTable (
     TableSize\r
     ));\r
 \r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " ItsGroupNodeCount = %d\n" \\r
-    " ItsGroupOffset = %d\n",\r
-    ItsGroupNodeCount,\r
-    ItsGroupOffset\r
-    ));\r
-\r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " NamedComponentNodeCount = %d\n" \\r
-    " NamedComponentOffset = %d\n",\r
-    NamedComponentNodeCount,\r
-    NamedComponentOffset\r
-    ));\r
-\r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " RootComplexNodeCount = %d\n" \\r
-    " RootComplexOffset = %d\n",\r
-    RootComplexNodeCount,\r
-    RootComplexOffset\r
-    ));\r
-\r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " SmmuV1V2NodeCount = %d\n" \\r
-    " SmmuV1V2Offset = %d\n",\r
-    SmmuV1V2NodeCount,\r
-    SmmuV1V2Offset\r
-    ));\r
-\r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " SmmuV3NodeCount = %d\n" \\r
-    " SmmuV3Offset = %d\n",\r
-    SmmuV3NodeCount,\r
-    SmmuV3Offset\r
-    ));\r
-\r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " PmcgNodeCount = %d\n" \\r
-    " PmcgOffset = %d\n",\r
-    PmcgNodeCount,\r
-    PmcgOffset\r
-    ));\r
-\r
   if (TableSize > MAX_UINT32) {\r
     Status = EFI_INVALID_PARAMETER;\r
     DEBUG ((\r