Reviewed-by: Alexei Fedorov <alexei.fedo...@arm.com>

Alexei

________________________________
From: Sami Mujawar <sami.muja...@arm.com>
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Sami Mujawar <sami.muja...@arm.com>; Alexei Fedorov 
<alexei.fedo...@arm.com>; leif.lindh...@linaro.org <leif.lindh...@linaro.org>; 
Matteo Carlini <matteo.carl...@arm.com>; nd <n...@arm.com>
Subject: [PATCH v1 14/19] DynamicTablesPkg: PPTT: Fix uninitialized memory usage

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.muja...@arm.com>
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 59 
++++++++++----------
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
index 
82070403ac8757f54e839fd00eb4acb3292fc60c..d70fc59e754e7d348965b8c3739822a9f1c4b7e6
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c
@@ -1203,6 +1203,17 @@ BuildPpttTable (
                    Generator->ProcHierarchyNodeCount,
                    &NodeIndexer
                    );
+
+    DEBUG ((
+      DEBUG_INFO,
+      " ProcHierarchyNodeCount = %d\n" \
+      " ProcHierarchyNodeOffset = 0x%x\n" \
+      " ProcHierarchyNodeIndexedList = 0x%p\n",
+      Generator->ProcHierarchyNodeCount,
+      ProcHierarchyNodeOffset,
+      Generator->ProcHierarchyNodeIndexedList
+      ));
+
   }

   // Include the size of Cache Type Structures and index them
@@ -1215,6 +1226,15 @@ BuildPpttTable (
                    Generator->CacheStructCount,
                    &NodeIndexer
                    );
+    DEBUG ((
+      DEBUG_INFO,
+      " CacheStructCount = %d\n" \
+      " CacheStructOffset = 0x%x\n" \
+      " CacheStructIndexedList = 0x%p\n",
+      Generator->CacheStructCount,
+      CacheStructOffset,
+      Generator->CacheStructIndexedList
+      ));
   }

   // Include the size of ID Type Structures and index them
@@ -1227,6 +1247,15 @@ BuildPpttTable (
                    Generator->IdStructCount,
                    &NodeIndexer
                    );
+    DEBUG ((
+      DEBUG_INFO,
+      " IdStructCount = %d\n" \
+      " IdStructOffset = 0x%x\n" \
+      " IdStructIndexedList = 0x%p\n",
+      Generator->IdStructCount,
+      IdStructOffset,
+      Generator->IdStructIndexedList
+      ));
   }

   DEBUG ((
@@ -1238,36 +1267,6 @@ BuildPpttTable (
     TableSize
     ));

-  DEBUG ((
-    DEBUG_INFO,
-    " ProcHierarchyNodeCount = %d\n" \
-    " ProcHierarchyNodeOffset = 0x%x\n" \
-    " ProcHierarchyNodeIndexedList = 0x%p\n",
-    Generator->ProcHierarchyNodeCount,
-    ProcHierarchyNodeOffset,
-    Generator->ProcHierarchyNodeIndexedList
-    ));
-
-  DEBUG ((
-    DEBUG_INFO,
-    " CacheStructCount = %d\n" \
-    " CacheStructOffset = 0x%x\n" \
-    " CacheStructIndexedList = 0x%p\n",
-    Generator->CacheStructCount,
-    CacheStructOffset,
-    Generator->CacheStructIndexedList
-    ));
-
-  DEBUG ((
-    DEBUG_INFO,
-    " IdStructCount = %d\n" \
-    " IdStructOffset = 0x%x\n" \
-    " IdStructIndexedList = 0x%p\n",
-    Generator->IdStructCount,
-    IdStructOffset,
-    Generator->IdStructIndexedList
-    ));
-
   // Allocate the Buffer for the PPTT table
   *Table = (EFI_ACPI_DESCRIPTION_HEADER*)AllocateZeroPool (TableSize);
   if (*Table == NULL) {
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46286): https://edk2.groups.io/g/devel/message/46286
Mute This Topic: https://groups.io/mt/32999800/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to