From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.3103.1663738252293285354 for ; Tue, 20 Sep 2022 22:30:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cyX3IN/R; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663738251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zUunG6QjBNa2jf1BfjVXt36UOnqVIPih9lSveDI4Zuc=; b=cyX3IN/RjUo9+pFV22RqendltnCO9tI8GiOo+QIRHBVvbjBGBC50GErCZMLFMADXnkoETH lsX9vLSF5mG9HnypF9e+cDRKrbCqCsx4Zqc6N23G6Sy0XDvJoZ3mOCe7pc9HK9jj/PFLHG PVfvRTpAQYIXpgidqx1Khb55vdnXqe0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-78-G45i8KgwObiebIs4c2ZuWA-1; Wed, 21 Sep 2022 01:30:49 -0400 X-MC-Unique: G45i8KgwObiebIs4c2ZuWA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00436811726; Wed, 21 Sep 2022 05:30:49 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBFF81759F; Wed, 21 Sep 2022 05:30:48 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3256C180039B; Wed, 21 Sep 2022 07:30:45 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jordan Justen , Gerd Hoffmann , Oliver Steffen , Ard Biesheuvel , Pawel Polawski , Jiewen Yao Subject: [PATCH 2/2] OvmfPkg/QemuBootOrderLib: skip over unsupported entries in StoreQemuBootOrder Date: Wed, 21 Sep 2022 07:30:45 +0200 Message-Id: <20220921053045.92473-3-kraxel@redhat.com> In-Reply-To: <20220921053045.92473-1-kraxel@redhat.com> References: <20220921053045.92473-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true When finding an unsupported entry just skip over and continue with the next entry instead of stop processing altogether. Signed-off-by: Gerd Hoffmann --- .../QemuBootOrderLib/QemuBootOrderLib.c | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c index 374c6d8f5e91..18646daa67e3 100644 --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c @@ -1775,35 +1775,39 @@ StoreQemuBootOrder ( Translated, &TranslatedSize ); - while (!RETURN_ERROR (Status)) { - EFI_DEVICE_PATH_PROTOCOL *DevicePath; + while (Status == EFI_SUCCESS || + Status == EFI_UNSUPPORTED) + { + if (Status == EFI_SUCCESS) { + EFI_DEVICE_PATH_PROTOCOL *DevicePath; - // - // Convert the UEFI devpath prefix to binary representation. - // - ASSERT (Translated[TranslatedSize] == L'\0'); - DevicePath = ConvertTextToDevicePath (Translated); - if (DevicePath == NULL) { - Status = RETURN_OUT_OF_RESOURCES; - goto FreeExtraPciRoots; + // + // Convert the UEFI devpath prefix to binary representation. + // + ASSERT (Translated[TranslatedSize] == L'\0'); + DevicePath = ConvertTextToDevicePath (Translated); + if (DevicePath == NULL) { + Status = RETURN_OUT_OF_RESOURCES; + goto FreeExtraPciRoots; + } + + UnicodeSPrint ( + VariableName, + sizeof (VariableName), + L"QemuBootOrder%04d", + VariableIndex++ + ); + DEBUG ((DEBUG_INFO, "%a: %s = %s\n", __FUNCTION__, VariableName, Translated)); + gRT->SetVariable ( + VariableName, + &gQemuBootOrderGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + GetDevicePathSize (DevicePath), + DevicePath + ); + FreePool (DevicePath); } - UnicodeSPrint ( - VariableName, - sizeof (VariableName), - L"QemuBootOrder%04d", - VariableIndex++ - ); - DEBUG ((DEBUG_INFO, "%a: %s = %s\n", __FUNCTION__, VariableName, Translated)); - gRT->SetVariable ( - VariableName, - &gQemuBootOrderGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - GetDevicePathSize (DevicePath), - DevicePath - ); - FreePool (DevicePath); - // // Move to the next OFW devpath. // -- 2.37.3