[PATCH v2] efi_selftest: fix guid comparison

Heinrich Schuchardt xypron.glpk at gmx.de
Wed Jun 17 20:52:12 CEST 2026


Am 15. Juni 2026 12:56:15 MESZ schrieb "Vincent Stehlé" <vincent.stehle at arm.com>:
>The `loaded image' efi selftest is comparing protocol GUIDs with the wrong
>polarity.
>This can be verified on the sandbox, where two protocols GUIDs are
>retrieved by the test from the image handle in the following order:
>
>1. Loaded Image Device Path Protocol GUID
>2. Loaded Image Protocol GUID
>
>The test matches on the first GUID, while it is in fact looking for the
>second one; fix the comparison polarity.
>
>Fixes: efe79a7c0de0 ("efi_selftest: test for loaded image protocol")
>Signed-off-by: Vincent Stehlé <vincent.stehle at arm.com>
>Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
>Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
>Cc: Tom Rini <trini at konsulko.com>
>Cc: Alexander Graf <agraf at csgraf.de>

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>


>---
>
>Changes for v2:
>- Continue using memcmp() and not guidcmp()
>- Keep the Loaded Image Protocol GUID definition
>- Fix Alexander's e-mail address
>
> lib/efi_selftest/efi_selftest_loaded_image.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/lib/efi_selftest/efi_selftest_loaded_image.c b/lib/efi_selftest/efi_selftest_loaded_image.c
>index 5889ab12617..e0668f60ebd 100644
>--- a/lib/efi_selftest/efi_selftest_loaded_image.c
>+++ b/lib/efi_selftest/efi_selftest_loaded_image.c
>@@ -60,8 +60,8 @@ static int execute(void)
> 	efi_st_printf("%u protocols installed on image handle\n",
> 		      (unsigned int)protocol_buffer_count);
> 	for (i = 0; i < protocol_buffer_count; ++i) {
>-		if (memcmp(protocol_buffer[i], &loaded_image_protocol_guid,
>-			   sizeof(efi_guid_t)))
>+		if (!memcmp(protocol_buffer[i], &loaded_image_protocol_guid,
>+			    sizeof(efi_guid_t)))
> 			found = true;
> 	}
> 	if (!found) {



More information about the U-Boot mailing list