[PATCH master 33/39] efi: loader: fix stale return value in console out-of-memory path

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 16 00:44:33 PST 2026


efi_console_register() returns the stale value of r in the
out_of_memory path. If efi_install_multiple_protocol_interfaces()
succeeded but a later allocation failed, r still holds EFI_SUCCESS,
masking the error.

Return EFI_OUT_OF_RESOURCES explicitly.

Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 efi/loader/protocols/console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efi/loader/protocols/console.c b/efi/loader/protocols/console.c
index d2c13196e4c2..857b38f5df32 100644
--- a/efi/loader/protocols/console.c
+++ b/efi/loader/protocols/console.c
@@ -1316,7 +1316,7 @@ static efi_status_t efi_console_register(void *data)
 	return r;
 out_of_memory:
 	pr_err("Out of memory\n");
-	return r;
+	return EFI_OUT_OF_RESOURCES;
 }
 
 static int efi_console_init(void)
-- 
2.47.3




More information about the barebox mailing list