[edk2-devel] [PATCH] Fix variables may be used uninitialize

Ni, Ray ray.ni at intel.com
Mon Jul 19 03:15:15 UTC 2021


Reviewed-by: Ray Ni <ray.ni at intel.com>

-----Original Message-----
From: Hsu, WesleyX <wesleyx.hsu at intel.com> 
Sent: Friday, July 16, 2021 2:38 PM
To: devel at edk2.groups.io
Cc: Hsu, WesleyX <wesleyx.hsu at intel.com>; Ni, Ray <ray.ni at intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty at intel.com>
Subject: [PATCH] Fix variables may be used uninitialize

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3491

Initialize variables may be used uninitialized after adding "-ffat-lto-objects" option in GCC5 tool chain.

Change-Id: Iec8c9a884bac5cf1ce7258867c074c4668e5fa44
Signed-off-by: WesleyX Hsu <wesleyx.hsu at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty at intel.com>
---
 Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/TranslationTable.c | 5 +++++
 Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c     | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/TranslationTable.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/TranslationTable.c
index 341e2beb..2a5fa637 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/TranslationTable.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDmarPei/Translat
+++ ionTable.c
@@ -107,6 +107,11 @@ CreateSecondLevelPagingEntryTable (
   UINT64                                EndAddress;
   BOOLEAN                               Is5LevelPaging;
 
+  Lvl4PagesStart     = 0;
+  Lvl4PagesEnd       = 0;
+  Lvl4PtEntry        = NULL;
+  Lvl5PtEntry        = NULL;
+
   if (MemoryLimit == 0) {
     return EFI_SUCCESS;
   }
diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
index d152039f..01375139 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationT
+++ able.c
@@ -133,7 +133,7 @@ CreateContextEntry (
       mVtdUnitInformation[VtdIndex].Is5LevelPaging = TRUE;
       if ((mAcpiDmarTable->HostAddressWidth <= 48) &&
           ((mVtdUnitInformation[VtdIndex].CapReg.Bits.SAGAW & BIT2) != 0)) {
-        mVtdUnitInformation[VtdIndex].Is5LevelPaging = FALSE;
+        mVtdUnitInformation[VtdIndex].Is5LevelPaging = FALSE;
       }
     } else if ((mVtdUnitInformation[VtdIndex].CapReg.Bits.SAGAW & BIT2) == 0) {
       DEBUG((DEBUG_ERROR, "!!!! Page-table type is not supported on VTD %d !!!!\n", VtdIndex)); @@ -195,6 +195,11 @@ CreateSecondLevelPagingEntryTable (
   UINT64                         BaseAddress;
   UINT64                         EndAddress;
 
+  Lvl4PagesStart     = 0;
+  Lvl4PagesEnd       = 0;
+  Lvl4PtEntry        = NULL;
+  Lvl5PtEntry        = NULL;
+
   if (MemoryLimit == 0) {
     return EFI_SUCCESS;
   }
--
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77866): https://edk2.groups.io/g/devel/message/77866
Mute This Topic: https://groups.io/mt/84244685/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list