From 72e7a82c883a62c9c00a846c3b64afe83c7ecc2c Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 15 Mar 2019 09:27:55 +0000 Subject: [PATCH] uefi: Check the error code of QueryCapsuleCapabilities() correctly We can't print max or reset as they are undefined in the event of failure. --- plugins/uefi/efi/fwupdate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/uefi/efi/fwupdate.c b/plugins/uefi/efi/fwupdate.c index c7a50f5de..2022f77b7 100644 --- a/plugins/uefi/efi/fwupdate.c +++ b/plugins/uefi/efi/fwupdate.c @@ -589,6 +589,10 @@ fwup_apply_capsules(EFI_CAPSULE_HEADER **capsules, rc = uefi_call_wrapper(RT->QueryCapsuleCapabilities, 4, capsules, num_updates, &max_capsule_size, reset); + if (EFI_ERROR(rc)) { + fwup_warning(L"Could not query capsule capabilities: %r", rc); + return rc; + } fwup_debug(L"QueryCapsuleCapabilities: %r max: %ld reset:%d", rc, max_capsule_size, *reset); fwup_debug(L"Capsules: %d", num_updates);