From e466d2498604c8eea055a8e98284d65311073b39 Mon Sep 17 00:00:00 2001 From: Patrick Masotta Date: Sat, 1 Aug 2015 07:40:16 -0400 Subject: [PATCH] efi/main: set/check for NULL in efi_create_binding() If LibLocateHandle() returns success and either 0 handles or we find no matching handles, treat it the same. Originally-By: Patrick Masotta Signed-off-by: Gene Cumm --- efi/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/efi/main.c b/efi/main.c index 4a3be4ce..6dbc259e 100644 --- a/efi/main.c +++ b/efi/main.c @@ -81,7 +81,7 @@ bool efi_get_MAC( EFI_DEVICE_PATH * pDevPath, uint8_t * mac, uint16_t mac_size) /* As of UEFI-2.4.0, all EFI_SERVICE_BINDINGs are for networking */ struct efi_binding *efi_create_binding(EFI_GUID *bguid, EFI_GUID *pguid) { - EFI_SERVICE_BINDING *sbp; + EFI_SERVICE_BINDING *sbp = NULL; struct efi_binding *b; EFI_STATUS status; EFI_HANDLE sb_handle, protocol, child; @@ -126,7 +126,7 @@ struct efi_binding *efi_create_binding(EFI_GUID *bguid, EFI_GUID *pguid) } } - if (status != EFI_SUCCESS) + if (status != EFI_SUCCESS || sbp == NULL) goto free_binding; child = NULL; -- 2.11.4.GIT