]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DynamicTablesPkg: PPTT: Fix uninitialized memory usage
authorSami Mujawar <sami.mujawar@arm.com>
Mon, 5 Aug 2019 15:43:37 +0000 (16:43 +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/AcpiPpttLibArm/PpttGenerator.c

index 82070403ac8757f54e839fd00eb4acb3292fc60c..d70fc59e754e7d348965b8c3739822a9f1c4b7e6 100644 (file)
@@ -1203,6 +1203,17 @@ BuildPpttTable (
                    Generator->ProcHierarchyNodeCount,\r
                    &NodeIndexer\r
                    );\r
                    Generator->ProcHierarchyNodeCount,\r
                    &NodeIndexer\r
                    );\r
+\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " ProcHierarchyNodeCount = %d\n" \\r
+      " ProcHierarchyNodeOffset = 0x%x\n" \\r
+      " ProcHierarchyNodeIndexedList = 0x%p\n",\r
+      Generator->ProcHierarchyNodeCount,\r
+      ProcHierarchyNodeOffset,\r
+      Generator->ProcHierarchyNodeIndexedList\r
+      ));\r
+\r
   }\r
 \r
   // Include the size of Cache Type Structures and index them\r
   }\r
 \r
   // Include the size of Cache Type Structures and index them\r
@@ -1215,6 +1226,15 @@ BuildPpttTable (
                    Generator->CacheStructCount,\r
                    &NodeIndexer\r
                    );\r
                    Generator->CacheStructCount,\r
                    &NodeIndexer\r
                    );\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " CacheStructCount = %d\n" \\r
+      " CacheStructOffset = 0x%x\n" \\r
+      " CacheStructIndexedList = 0x%p\n",\r
+      Generator->CacheStructCount,\r
+      CacheStructOffset,\r
+      Generator->CacheStructIndexedList\r
+      ));\r
   }\r
 \r
   // Include the size of ID Type Structures and index them\r
   }\r
 \r
   // Include the size of ID Type Structures and index them\r
@@ -1227,6 +1247,15 @@ BuildPpttTable (
                    Generator->IdStructCount,\r
                    &NodeIndexer\r
                    );\r
                    Generator->IdStructCount,\r
                    &NodeIndexer\r
                    );\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      " IdStructCount = %d\n" \\r
+      " IdStructOffset = 0x%x\n" \\r
+      " IdStructIndexedList = 0x%p\n",\r
+      Generator->IdStructCount,\r
+      IdStructOffset,\r
+      Generator->IdStructIndexedList\r
+      ));\r
   }\r
 \r
   DEBUG ((\r
   }\r
 \r
   DEBUG ((\r
@@ -1238,36 +1267,6 @@ BuildPpttTable (
     TableSize\r
     ));\r
 \r
     TableSize\r
     ));\r
 \r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " ProcHierarchyNodeCount = %d\n" \\r
-    " ProcHierarchyNodeOffset = 0x%x\n" \\r
-    " ProcHierarchyNodeIndexedList = 0x%p\n",\r
-    Generator->ProcHierarchyNodeCount,\r
-    ProcHierarchyNodeOffset,\r
-    Generator->ProcHierarchyNodeIndexedList\r
-    ));\r
-\r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " CacheStructCount = %d\n" \\r
-    " CacheStructOffset = 0x%x\n" \\r
-    " CacheStructIndexedList = 0x%p\n",\r
-    Generator->CacheStructCount,\r
-    CacheStructOffset,\r
-    Generator->CacheStructIndexedList\r
-    ));\r
-\r
-  DEBUG ((\r
-    DEBUG_INFO,\r
-    " IdStructCount = %d\n" \\r
-    " IdStructOffset = 0x%x\n" \\r
-    " IdStructIndexedList = 0x%p\n",\r
-    Generator->IdStructCount,\r
-    IdStructOffset,\r
-    Generator->IdStructIndexedList\r
-    ));\r
-\r
   // Allocate the Buffer for the PPTT table\r
   *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);\r
   if (*Table == NULL) {\r
   // Allocate the Buffer for the PPTT table\r
   *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);\r
   if (*Table == NULL) {\r