Skip to content

Commit 594e576

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
efi/libstub/arm: Fix spurious message that an initrd was loaded
Commit: ec93fc3 ("efi/libstub: Add support for loading the initrd from a device path") added a diagnostic print to the ARM version of the EFI stub that reports whether an initrd has been loaded that was passed via the command line using initrd=. However, it failed to take into account that, for historical reasons, the file loading routines return EFI_SUCCESS when no file was found, and the only way to decide whether a file was loaded is to inspect the 'size' argument that is passed by reference. So let's inspect this returned size, to prevent the print from being emitted even if no initrd was loaded at all. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected]
1 parent c2136dc commit 594e576

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firmware/efi/libstub/arm-stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ efi_status_t efi_entry(efi_handle_t handle, efi_system_table_t *sys_table_arg)
277277
} else if (status == EFI_NOT_FOUND) {
278278
status = efi_load_initrd(image, &initrd_addr, &initrd_size,
279279
ULONG_MAX, max_addr);
280-
if (status == EFI_SUCCESS)
280+
if (status == EFI_SUCCESS && initrd_size > 0)
281281
pr_efi("Loaded initrd from command line option\n");
282282
}
283283
if (status != EFI_SUCCESS)

0 commit comments

Comments
 (0)