[edk2-devel] [PATCH 2/3] MdeModulePkg/EsrtFmpDxe: Correct LastAttemptVersion algorithm in ESRT

Eric Jin eric.jin at intel.com
Wed Jul 31 15:03:37 UTC 2019


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

Update the ESRT entry with the last attempt status and last attempt
version from the first FMP instance whose last attempt status is not
SUCCESS. If all FMP instances are SUCCESS, then set last attempt version
to the smallest value from all FMP instances

Cc: Sean Brogan <sean.brogan at microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew at microsoft.com>
Cc: Michael D Kinney <michael.d.kinney at intel.com>
Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>
Signed-off-by: Eric Jin <eric.jin at intel.com>
---
 MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
index d48f205797..804c6d2ca3 100644
--- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
+++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
@@ -179,20 +179,22 @@ CreateEsrtEntry (
       // VERSION 3 supports last attempt values
       //
       if (FmpVersion >= 3) {
-        Entry->LastAttemptVersion =
-          MIN (
-            FmpImageInfoBuf->LastAttemptVersion,
-            Entry->LastAttemptVersion
-            );
         //
         // Update the ESRT entry with the last attempt status and last attempt
         // version from the first FMP instance whose last attempt status is not
-        // SUCCESS.
+        // SUCCESS.  If all FMP instances are SUCCESS, then set version to the
+        // smallest value from all FMP instances.
         //
         if (Entry->LastAttemptStatus == LAST_ATTEMPT_STATUS_SUCCESS) {
           if (FmpImageInfoBuf->LastAttemptStatus != LAST_ATTEMPT_STATUS_SUCCESS) {
             Entry->LastAttemptStatus = FmpImageInfoBuf->LastAttemptStatus;
             Entry->LastAttemptVersion = FmpImageInfoBuf->LastAttemptVersion;
+          } else {
+            Entry->LastAttemptVersion =
+              MIN (
+                FmpImageInfoBuf->LastAttemptVersion,
+                Entry->LastAttemptVersion
+                );
           }
         }
       }
-- 
2.20.1.windows.1


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

View/Reply Online (#44682): https://edk2.groups.io/g/devel/message/44682
Mute This Topic: https://groups.io/mt/32667825/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