summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_init.c
diff options
context:
space:
mode:
authorMichael Brown2025-03-23 20:38:14 +0100
committerMichael Brown2025-03-24 14:19:26 +0100
commit5a5e2a1dae525aecf97dffde2236b74710735c8d (patch)
treef396e2ed8c211193272e7f9af705fe8c9321f949 /src/interface/efi/efi_init.c
parent[efi] Use efi_open_by_driver() for all by-driver protocol opens (diff)
downloadipxe-5a5e2a1dae525aecf97dffde2236b74710735c8d.tar.gz
ipxe-5a5e2a1dae525aecf97dffde2236b74710735c8d.tar.xz
ipxe-5a5e2a1dae525aecf97dffde2236b74710735c8d.zip
[efi] Use efi_open_unsafe() for all explicitly unsafe protocol opens
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_init.c')
-rw-r--r--src/interface/efi/efi_init.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/interface/efi/efi_init.c b/src/interface/efi/efi_init.c
index d3c5042d7..a45ee66a4 100644
--- a/src/interface/efi/efi_init.c
+++ b/src/interface/efi/efi_init.c
@@ -241,14 +241,17 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle,
}
}
- /* Get loaded image protocol */
- if ( ( efirc = bs->OpenProtocol ( image_handle,
- &efi_loaded_image_protocol_guid,
- &loaded_image, image_handle, NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) {
- rc = -EEFI ( efirc );
+ /* Get loaded image protocol
+ *
+ * We assume that our loaded image protocol will not be
+ * uninstalled while our image code is still running.
+ */
+ if ( ( rc = efi_open_unsafe ( image_handle,
+ &efi_loaded_image_protocol_guid,
+ &loaded_image ) ) != 0 ) {
DBGC ( systab, "EFI could not get loaded image protocol: %s",
strerror ( rc ) );
+ efirc = EFIRC ( rc );
goto err_no_loaded_image;
}
efi_loaded_image = loaded_image;