From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.18484.1574303598474640180 for ; Wed, 20 Nov 2019 18:33:18 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: michael.a.kubacki@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2019 18:33:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,224,1571727600"; d="scan'208";a="197078616" Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga007.jf.intel.com with ESMTP; 20 Nov 2019 18:33:17 -0800 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Liming Gao , Michael D Kinney , Jian J Wang , Hao A Wu Subject: [PATCH V1 1/1] MdeModulePkg/Variable: Initialize local variable Date: Wed, 20 Nov 2019 18:32:56 -0800 Message-Id: <20191121023256.24820-1-michael.a.kubacki@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2364 Fixes a new build warning in VS2012 introduced in f8ff4cca7c. This patch initializes the local variable "Variable" in VariableServiceGetNextVariableInternal () and the local variable "RtPtrTrack" in FindVariableInRuntimeCache (). This enusres the pointers in the structures are initialized in the case no variable stores exist in the list of variable stores. Cc: Liming Gao Cc: Michael D Kinney Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Michael Kubacki --- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c | 2 ++ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c index d458f1c608..f6d187543d 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c @@ -551,6 +551,8 @@ VariableServiceGetNextVariableInternal ( return EFI_INVALID_PARAMETER; } + ZeroMem (&Variable, sizeof (Variable)); + // Check if the variable exists in the given variable store list for (StoreType = (VARIABLE_STORE_TYPE) 0; StoreType < VariableStoreTypeMax; StoreType++) { if (VariableStoreList[StoreType] == NULL) { diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c index d525998ae3..2cf0ed32ae 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c @@ -590,6 +590,8 @@ FindVariableInRuntimeCache ( return EFI_INVALID_PARAMETER; } + ZeroMem (&RtPtrTrack, sizeof (RtPtrTrack)); + // // The UEFI specification restricts Runtime Services callers from invoking the same or certain other Runtime Service // functions prior to completion and return from a previous Runtime Service call. These restrictions prevent -- 2.16.2.windows.1