From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id ED18522618173 for ; Sun, 15 Apr 2018 22:39:25 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2018 22:39:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,458,1517904000"; d="scan'208";a="33649855" Received: from orsmsx106.amr.corp.intel.com ([10.22.225.133]) by orsmga007.jf.intel.com with ESMTP; 15 Apr 2018 22:39:25 -0700 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX106.amr.corp.intel.com (10.22.225.133) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 15 Apr 2018 22:39:25 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.55]) by ORSMSX159.amr.corp.intel.com ([169.254.11.191]) with mapi id 14.03.0319.002; Sun, 15 Apr 2018 22:39:24 -0700 From: "Kinney, Michael D" To: "Yao, Jiewen" , "Zeng, Star" , "edk2-devel@lists.01.org" , "Kinney, Michael D" Thread-Topic: [PATCH] SignedCapsulePkg SystemFirmwareUpdateDxe: Fix failure caused by d69d922 Thread-Index: AQHT0w8a9RIhkPVVFU6hTkng459HG6QDGXOA///KpEA= Date: Mon, 16 Apr 2018 05:39:24 +0000 Message-ID: References: <1523613978-121936-1-git-send-email-star.zeng@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503AB624DE@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503AB624DE@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: [PATCH] SignedCapsulePkg SystemFirmwareUpdateDxe: Fix failure caused by d69d922 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2018 05:39:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Star, Thanks for fixing these issues. Reviewed-by: Michael D Kinney Mike > -----Original Message----- > From: Yao, Jiewen > Sent: Sunday, April 15, 2018 6:49 PM > To: Zeng, Star ; edk2- > devel@lists.01.org > Cc: Kinney, Michael D > Subject: RE: [PATCH] SignedCapsulePkg > SystemFirmwareUpdateDxe: Fix failure caused by d69d922 >=20 > Reviewed-by: jiewen.yao@intel.com >=20 >=20 >=20 > > -----Original Message----- > > From: Zeng, Star > > Sent: Friday, April 13, 2018 6:06 PM > > To: edk2-devel@lists.01.org > > Cc: Zeng, Star ; Kinney, Michael > D > > ; Yao, Jiewen > > > Subject: [PATCH] SignedCapsulePkg > SystemFirmwareUpdateDxe: Fix failure > > caused by d69d922 > > > > d69d9227d046211265de1fab5580c50a65944614 caused > system firmware > > update > > failure. It is because FindMatchingFmpHandles() is > expected to return > > handles matched, but the function returns all handles > found. > > > > This patch is to fix the issue. > > This patch also assigns mSystemFmpPrivate->Handle for > "case 1:" path > > in case the Handle is needed by other place in > future. > > > > Cc: Michael D Kinney > > Cc: Jiewen Yao > > Contributed-under: TianoCore Contribution Agreement > 1.1 > > Signed-off-by: Star Zeng > > --- > > .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c > | 21 > > ++++++++++++++++----- > > 1 file changed, 16 insertions(+), 5 deletions(-) > > > > diff --git > > > a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/Syste > mFirmwareUpdate > > Dxe.c > > > b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/Syste > mFirmwareUpdat > > eDxe.c > > index d0b1c9913ca8..fa0c5f03ffdd 100644 > > --- > > > a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/Syste > mFirmwareUpdate > > Dxe.c > > +++ > > > b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/Syste > mFirmwareUpdat > > eDxe.c > > @@ -602,6 +602,7 @@ FindMatchingFmpHandles ( > > ) > > { > > EFI_STATUS Status; > > + UINTN TempHandleCount; > > EFI_HANDLE *HandleBuffer; > > UINTN Index; > > UINTN Index2; > > @@ -613,20 +614,20 @@ FindMatchingFmpHandles ( > > BOOLEAN MatchFound; > > > > *HandleCount =3D 0; > > + TempHandleCount =3D 0; > > HandleBuffer =3D NULL; > > Status =3D gBS->LocateHandleBuffer ( > > ByProtocol, > > ProtocolGuid, > > NULL, > > - HandleCount, > > + &TempHandleCount, > > &HandleBuffer > > ); > > if (EFI_ERROR (Status)) { > > - *HandleCount =3D 0; > > return NULL; > > } > > > > - for (Index =3D 0; Index < *HandleCount; Index++) { > > + for (Index =3D 0; Index < TempHandleCount; Index++) > { > > OriginalFmpImageInfoBuf =3D GetFmpImageDescriptors > ( > > HandleBuffer[Index], > > ProtocolGuid, > > @@ -657,12 +658,21 @@ FindMatchingFmpHandles ( > > // > > FmpImageInfoBuf =3D > (EFI_FIRMWARE_IMAGE_DESCRIPTOR *)(((UINT8 > > *)FmpImageInfoBuf) + DescriptorSize); > > } > > - if (!MatchFound) { > > - HandleBuffer[Index] =3D NULL; > > + if (MatchFound) { > > + HandleBuffer[*HandleCount] =3D > HandleBuffer[Index]; > > + (*HandleCount)++; > > } > > > > FreePool (OriginalFmpImageInfoBuf); > > } > > + > > + if ((*HandleCount) =3D=3D 0) { > > + // > > + // No any matching handle. > > + // > > + FreePool (HandleBuffer); > > + return NULL; > > + } > > return HandleBuffer; > > } > > > > @@ -801,6 +811,7 @@ SystemFirmwareUpdateMainDxe ( > > // Install System FMP protocol onto handle with > matching FMP Protocol > > // > > DEBUG ((DEBUG_INFO, "SystemFirmwareUpdateDxe: > Install System FMP > > onto matching FMP handle\n")); > > + mSystemFmpPrivate->Handle =3D HandleBuffer[0]; > > Status =3D gBS->InstallMultipleProtocolInterfaces > ( > > &HandleBuffer[0], > > &gSystemFmpProtocolGuid, > > -- > > 2.7.0.windows.1