[U-Boot] [PATCH 1/1] efi_loader: HandleProtocol parameter checks

Heinrich Schuchardt xypron.glpk at gmx.de
Sun May 5 10:49:53 UTC 2019


HandleProtocol() and OpenProtocol() have to return EFI_UNSUPPORTED if the
protocol is not installed on the handle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/efi_loader/efi_boottime.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index af9b2f4df3..5104ad5b83 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2638,8 +2638,15 @@ static efi_status_t EFIAPI efi_open_protocol
 	}

 	r = efi_search_protocol(handle, protocol, &handler);
-	if (r != EFI_SUCCESS)
+	switch (r) {
+	case EFI_SUCCESS:
+		break;
+	case EFI_NOT_FOUND:
+		r = EFI_UNSUPPORTED;
 		goto out;
+	default:
+		goto out;
+	}

 	r = efi_protocol_open(handler, protocol_interface, agent_handle,
 			      controller_handle, attributes);
--
2.20.1



More information about the U-Boot mailing list