From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: eric.jin@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Thu, 01 Aug 2019 01:47:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2019 01:47:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,333,1559545200"; d="scan'208";a="372535130" Received: from jjin9-mobl.ccr.corp.intel.com ([10.239.192.65]) by fmsmga006.fm.intel.com with ESMTP; 01 Aug 2019 01:47:11 -0700 From: "Eric Jin" To: devel@edk2.groups.io Cc: Sean Brogan , Bret Barkelew , Liming Gao , Michael D Kinney Subject: [PATCH 11/14] FmpDevicePkg/FmpDxe: Fix SetLowestSupportedVersionInVariable() Date: Thu, 1 Aug 2019 16:47:06 +0800 Message-Id: <20190801084706.6728-1-eric.jin@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525 The change that merged 4 UEFI Variables per device into a single UEFI variable per device introduced a change in the behavior of SetLowestSupportedVersionInVariable(). The UEFI Variable should be updated if the current value is less than the new value. The BOOLEAN local variable Update in all 4 Setxxx() functions is also not initialized before use. Initialize Update to FALSE in all 4 functions. Cc: Sean Brogan Cc: Bret Barkelew Cc: Liming Gao Signed-off-by: Michael D Kinney Reviewed-by: Eric Jin --- FmpDevicePkg/FmpDxe/VariableSupport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FmpDevicePkg/FmpDxe/VariableSupport.c b/FmpDevicePkg/FmpDxe/VariableSupport.c index 2508d3bbe6..414a077ab2 100644 --- a/FmpDevicePkg/FmpDxe/VariableSupport.c +++ b/FmpDevicePkg/FmpDxe/VariableSupport.c @@ -491,6 +491,7 @@ SetVersionInVariable ( return; } + Update = FALSE; if (!FmpControllerState->VersionValid) { Update = TRUE; } @@ -553,10 +554,11 @@ SetLowestSupportedVersionInVariable ( return; } + Update = FALSE; if (!FmpControllerState->LsvValid) { Update = TRUE; } - if (FmpControllerState->Lsv != LowestSupportedVersion) { + if (FmpControllerState->Lsv < LowestSupportedVersion) { Update = TRUE; } FmpControllerState->LsvValid = TRUE; @@ -615,6 +617,7 @@ SetLastAttemptStatusInVariable ( return; } + Update = FALSE; if (!FmpControllerState->LastAttemptStatusValid) { Update = TRUE; } @@ -677,6 +680,7 @@ SetLastAttemptVersionInVariable ( return; } + Update = FALSE; if (!FmpControllerState->LastAttemptVersionValid) { Update = TRUE; } -- 2.20.1.windows.1