All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi_loader: fix uninitialized variable bug in efi_set_load_options()
@ 2023-07-27  7:15 Dan Carpenter
  2023-07-27  8:23 ` Ilias Apalodimas
  2023-07-27  8:27 ` Heinrich Schuchardt
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-07-27  7:15 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Ilias Apalodimas, u-boot

Check for efi_search_protocol() failure before dereferencing "handler"
to avoid a crash.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 lib/efi_loader/efi_load_options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_load_options.c b/lib/efi_loader/efi_load_options.c
index 3cfddee014e9..5f62184da1cd 100644
--- a/lib/efi_loader/efi_load_options.c
+++ b/lib/efi_loader/efi_load_options.c
@@ -31,10 +31,10 @@ efi_status_t efi_set_load_options(efi_handle_t handle,
 	efi_status_t ret;
 
 	ret = efi_search_protocol(handle, &efi_guid_loaded_image, &handler);
-	loaded_image_info = handler->protocol_interface;
 	if (ret != EFI_SUCCESS)
 		return EFI_INVALID_PARAMETER;
 
+	loaded_image_info = handler->protocol_interface;
 	loaded_image_info->load_options = load_options;
 	loaded_image_info->load_options_size = load_options_size;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-27 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-27  7:15 [PATCH] efi_loader: fix uninitialized variable bug in efi_set_load_options() Dan Carpenter
2023-07-27  8:23 ` Ilias Apalodimas
2023-07-27  8:27 ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.