OvmfPkg/QemuBootOrderLib: skip unsupported entries in StoreQemuBootOrder

When finding an unsupported entry just skip over and continue
with the next entry instead of stop processing altogether.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Gerd Hoffmann 2022-09-21 07:30:45 +02:00 committed by mergify[bot]
parent d63242bd69
commit b7213bbd59
1 changed files with 30 additions and 26 deletions

View File

@ -1775,35 +1775,39 @@ StoreQemuBootOrder (
Translated, Translated,
&TranslatedSize &TranslatedSize
); );
while (!RETURN_ERROR (Status)) { while (Status == EFI_SUCCESS ||
EFI_DEVICE_PATH_PROTOCOL *DevicePath; Status == EFI_UNSUPPORTED)
{
if (Status == EFI_SUCCESS) {
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
// //
// Convert the UEFI devpath prefix to binary representation. // Convert the UEFI devpath prefix to binary representation.
// //
ASSERT (Translated[TranslatedSize] == L'\0'); ASSERT (Translated[TranslatedSize] == L'\0');
DevicePath = ConvertTextToDevicePath (Translated); DevicePath = ConvertTextToDevicePath (Translated);
if (DevicePath == NULL) { if (DevicePath == NULL) {
Status = RETURN_OUT_OF_RESOURCES; Status = RETURN_OUT_OF_RESOURCES;
goto FreeExtraPciRoots; 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. // Move to the next OFW devpath.
// //