summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2024-01-16 18:11:04 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-01-18 19:25:14 +0000
commit735d0a5e2e25c1577bf9bea7826da937ca38169d (patch)
treee58a08bdc6cfeb9bbdb9e6a4dae3a1cd43367883
parentb25733c97442513890ae6bb8e10fd340f13844a7 (diff)
downloadedk2-735d0a5e2e25c1577bf9bea7826da937ca38169d.tar.gz
edk2-735d0a5e2e25c1577bf9bea7826da937ca38169d.tar.bz2
edk2-735d0a5e2e25c1577bf9bea7826da937ca38169d.zip
OvmfPkg/VirtNorFlashDxe: ValidateFvHeader: unwritten state is EOL too
It is possible to find variable entries with State being 0xff, i.e. not updated since flash block erase. This indicates the variable driver could not complete the header write while appending a new entry, and therefore State was not set to VAR_HEADER_VALID_ONLY. This can only happen at the end of the variable list, so treat this as additional "end of variable list" condition. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-6-kraxel@redhat.com>
-rw-r--r--OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c
index 8fcd999ac6..c8b5e0be13 100644
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c
@@ -302,6 +302,11 @@ ValidateFvHeader (
break;
}
+ if (VarHeader->State == 0xff) {
+ DEBUG ((DEBUG_INFO, "%a: end of var list (unwritten state)\n", __func__));
+ break;
+ }
+
VarName = NULL;
switch (VarHeader->State) {
// usage: State = VAR_HEADER_VALID_ONLY