From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.6608.1588924657245252217 for ; Fri, 08 May 2020 00:57:37 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6D391FB; Fri, 8 May 2020 00:57:35 -0700 (PDT) Received: from [192.168.1.81] (unknown [10.37.8.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 739603F305; Fri, 8 May 2020 00:57:34 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH 1/1] SignedCapsulePkg: Add handling of NULL returned from FMP Descriptor To: devel@edk2.groups.io, gaurav.jain@nxp.com Cc: Jiewen Yao , Chao Zhang , Pankaj Bansal References: <1588755253-25016-1-git-send-email-gaurav.jain@nxp.com> From: "Ard Biesheuvel" Message-ID: Date: Fri, 8 May 2020 09:57:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <1588755253-25016-1-git-send-email-gaurav.jain@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 5/6/20 10:54 AM, Gaurav Jain via groups.io wrote: > Firmware management protocol that does not support GetImageInfo > return Unsupported. The UEFI spec does not list EFI_UNSUPPORTED as a permitted return value for EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo() What is the point of producing the protocol in this case? > hence FMP Image Information Buffer is NULL. > Freeing NULL buffer results in Exception. > > Added NULL check for Image Info buffer > and skip processing FMP protocol handle, > which does not support GetImageInfo. > > Signed-off-by: Gaurav Jain > --- > .../Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c > index bdb70bdb32cc..b4438ac6f55a 100644 > --- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c > +++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c > @@ -579,7 +579,7 @@ GetFmpImageDescriptors ( > &PackageVersionName // PackageVersionName > ); > if (Status != EFI_BUFFER_TOO_SMALL) { > - DEBUG ((DEBUG_ERROR, "SystemFirmwareUpdateDxe: Unexpected Failure. Status = %r\n", Status)); > + DEBUG ((DEBUG_INFO, "SystemFirmwareUpdateDxe: Status = %r\n", Status)); > return NULL; > } > > @@ -678,6 +678,9 @@ FindMatchingFmpHandles ( > &DescriptorSize > ); > > + if (OriginalFmpImageInfoBuf == NULL) { > + continue; > + } > // > // Loop through the set of EFI_FIRMWARE_IMAGE_DESCRIPTORs. > // >