From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bounce+27952+113729+7686176+12367111@groups.io>
Received: from mail02.groups.io (mail02.groups.io [66.175.222.108])
	by spool.mail.gandi.net (Postfix) with ESMTPS id DCC0A7803E4
	for <rebecca@openfw.io>; Fri, 12 Jan 2024 12:17:04 +0000 (UTC)
DKIM-Signature: a=rsa-sha256; bh=qi6+UJCAz8vaFamvZQxGgmhUW1kt8G6yG98rLm7qgos=;
 c=relaxed/simple; d=groups.io;
 h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type;
 s=20140610; t=1705061823; v=1;
 b=dFq+AL2xHAgU4XY5xSNWH4DONUhlrFkQw6WYCymcdndLR9UIY2USRhJMG4HU3yPaqPB2ixQm
 xy+QpS2BxePzNmIss60ZG2n/PepyjJ9B89qxvVqRJLEYDh0tWiwDCO4NXiDDnsYLGpR5siSyLPe
 QWNL1FPxWzeZ+8BLN9wkVgw8=
X-Received: by 127.0.0.2 with SMTP id tIeIYY7687511xTRt0Da0IWi; Fri, 12 Jan 2024 04:17:03 -0800
X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])
 by mx.groups.io with SMTP id smtpd.web10.5691.1705061822804290826
 for <devel@edk2.groups.io>;
 Fri, 12 Jan 2024 04:17:03 -0800
X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])
	by ams.source.kernel.org (Postfix) with ESMTP id 557C3B81CC0
	for <devel@edk2.groups.io>; Fri, 12 Jan 2024 12:17:01 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB8F9C433F1
	for <devel@edk2.groups.io>; Fri, 12 Jan 2024 12:17:00 +0000 (UTC)
X-Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-50ea9daac4cso6533446e87.3
        for <devel@edk2.groups.io>; Fri, 12 Jan 2024 04:17:00 -0800 (PST)
X-Gm-Message-State: xf84tnPRuzFDsbzqmcCIR7Zqx7686176AA=
X-Google-Smtp-Source: AGHT+IHSClvsPwe7Bw2Ivi0DbkwN/KAlENJoiy0rlTuy09TSLlrda7h7lO91qVjnZD8swLKbTLVZep4A41RcwkAkR7U=
X-Received: by 2002:a05:6512:1055:b0:50e:7f88:f541 with SMTP id
 c21-20020a056512105500b0050e7f88f541mr776935lfb.16.1705061818933; Fri, 12 Jan
 2024 04:16:58 -0800 (PST)
MIME-Version: 1.0
References: <20240112113754.14710-1-kraxel@redhat.com> <20240112113754.14710-5-kraxel@redhat.com>
In-Reply-To: <20240112113754.14710-5-kraxel@redhat.com>
From: "Ard Biesheuvel" <ardb@kernel.org>
Date: Fri, 12 Jan 2024 13:16:47 +0100
X-Gmail-Original-Message-ID: <CAMj1kXH9mUUeAE_YaOz+ZE0FMmCmn-r4+xGk3crikRZ0yLBtdw@mail.gmail.com>
Message-ID: <CAMj1kXH9mUUeAE_YaOz+ZE0FMmCmn-r4+xGk3crikRZ0yLBtdw@mail.gmail.com>
Subject: Re: [edk2-devel] [PATCH 4/4] OvmfPkg/VirtNorFlashDxe: ValidateFvHeader: unwritten state is EOL too
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: devel@edk2.groups.io, Laszlo Ersek <lersek@redhat.com>, 
	Jiewen Yao <jiewen.yao@intel.com>, oliver@redhat.com
Precedence: Bulk
List-Subscribe: <mailto:devel+subscribe@edk2.groups.io>
List-Help: <mailto:devel+help@edk2.groups.io>
Sender: devel@edk2.groups.io
List-Id: <devel.edk2.groups.io>
Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io
Reply-To: devel@edk2.groups.io,ardb@kernel.org
List-Unsubscribe-Post: List-Unsubscribe=One-Click
List-Unsubscribe: <https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/plugh>
Content-Type: text/plain; charset="UTF-8"
X-GND-Status: LEGIT
Authentication-Results: spool.mail.gandi.net;
	dkim=pass header.d=groups.io header.s=20140610 header.b=dFq+AL2x;
	dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none);
	spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io

On Fri, 12 Jan 2024 at 12:38, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> It is possible to find variable entries with State being 0xff,
> i.e. not updated since flash block erase.   This indicates the
> header write was not completed (and therefore State was not set
> to VAR_HEADER_VALID_ONLY).  Treat this as additional "end of
> variable list" condition.
>

Why?

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c
> index 8fcd999ac6df..c8b5e0be1379 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
> --
> 2.43.0
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113729): https://edk2.groups.io/g/devel/message/113729
Mute This Topic: https://groups.io/mt/103680936/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-