From: Zbigniew Jędrzejewski-Szmek Date: Mon, 27 Nov 2017 13:31:46 +0000 (+0000) Subject: shim: fix logically dead code X-Git-Tag: v236~102^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d44f5a63746d28b1e6db6f57a8005ba84a8869c;p=thirdparty%2Fsystemd.git shim: fix logically dead code The alternate verification path could never be taken. Found by coverity. --- diff --git a/src/boot/efi/shim.c b/src/boot/efi/shim.c index d66b39be236..6d7d814c5cc 100644 --- a/src/boot/efi/shim.c +++ b/src/boot/efi/shim.c @@ -62,10 +62,7 @@ static BOOLEAN shim_validate(VOID *data, UINT32 size) { if (!shim_lock) return FALSE; - if (shim_lock->shim_verify(data, size) == EFI_SUCCESS) - return TRUE; - - return FALSE; + return shim_lock->shim_verify(data, size) == EFI_SUCCESS; } BOOLEAN secure_boot_enabled(void) { @@ -188,12 +185,10 @@ static EFIAPI EFI_STATUS security_policy_authentication (const EFI_SECURITY_PROT if (shim_validate(file_buffer, file_size)) status = EFI_SUCCESS; - - FreePool(file_buffer); - - /* Try using the platform's native policy.... */ - if (status != EFI_SUCCESS) + else + /* Try using the platform's native policy.... */ status = uefi_call_wrapper(esfas, 3, this, authentication_status, device_path_const); + FreePool(file_buffer); return status; }