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.24; helo=mga09.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 BE47822526485 for ; Sun, 15 Apr 2018 18:49:19 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2018 18:49:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,457,1517904000"; d="scan'208";a="37594042" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 15 Apr 2018 18:49:18 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 15 Apr 2018 18:49:18 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 15 Apr 2018 18:49:17 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.239]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.149]) with mapi id 14.03.0319.002; Mon, 16 Apr 2018 09:49:10 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" Thread-Topic: [PATCH] SignedCapsulePkg SystemFirmwareUpdateDxe: Fix failure caused by d69d922 Thread-Index: AQHT0w8bsCn6IoBFsE+S/tHcwjsC8aQCo+Bw Date: Mon, 16 Apr 2018 01:49:09 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AB624DE@SHSMSX104.ccr.corp.intel.com> References: <1523613978-121936-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1523613978-121936-1-git-send-email-star.zeng@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjMxMTlkOGMtYTE4Zi00NTZiLTk5MzYtMTQ4YmNlNTg5NmUwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ6QlJDU0QwZkFDRkU0bVRRQjBsTWdjZFBYSkk1dUFNd3NjM2piZkw4aXpQdEJsbHdTUmpwckUyQlNuZHJhakFDIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] 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 01:49:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: jiewen.yao@intel.com > -----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 >=20 > d69d9227d046211265de1fab5580c50a65944614 caused system firmware > update > failure. It is because FindMatchingFmpHandles() is expected to return > handles matched, but the function returns all handles found. >=20 > 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. >=20 > 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(-) >=20 > diff --git > a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdate > Dxe.c > b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdat > eDxe.c > index d0b1c9913ca8..fa0c5f03ffdd 100644 > --- > a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdate > Dxe.c > +++ > b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdat > 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; >=20 > *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; > } >=20 > - 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)++; > } >=20 > FreePool (OriginalFmpImageInfoBuf); > } > + > + if ((*HandleCount) =3D=3D 0) { > + // > + // No any matching handle. > + // > + FreePool (HandleBuffer); > + return NULL; > + } > return HandleBuffer; > } >=20 > @@ -801,6 +811,7 @@ SystemFirmwareUpdateMainDxe ( > // Install System FMP protocol onto handle with matching FMP Protoco= l > // > 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