From nobody Sun Apr 28 06:46:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 15236139856251011.4068625104596; Fri, 13 Apr 2018 03:06:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4DF2C226EAC99; Fri, 13 Apr 2018 03:06:24 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 5726021EA15AC for ; Fri, 13 Apr 2018 03:06:22 -0700 (PDT) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2018 03:06:21 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.46]) by orsmga008.jf.intel.com with ESMTP; 13 Apr 2018 03:06:20 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,444,1517904000"; d="scan'208";a="33390515" From: Star Zeng To: edk2-devel@lists.01.org Date: Fri, 13 Apr 2018 18:06:18 +0800 Message-Id: <1523613978-121936-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [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: , Cc: Michael D Kinney , Jiewen Yao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Michael D Kinney Reviewed-by: jiewen.yao@intel.com --- .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 21 ++++++++++++++++-= ---- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmware= UpdateDxe.c b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwar= eUpdateDxe.c index d0b1c9913ca8..fa0c5f03ffdd 100644 --- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateD= xe.c +++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateD= xe.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 *)FmpI= mageInfoBuf) + 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 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, --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel