.../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
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 <michael.d.kinney@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
.../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
index d0b1c9913ca8..fa0c5f03ffdd 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.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 = 0;
+ TempHandleCount = 0;
HandleBuffer = NULL;
Status = gBS->LocateHandleBuffer (
ByProtocol,
ProtocolGuid,
NULL,
- HandleCount,
+ &TempHandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
- *HandleCount = 0;
return NULL;
}
- for (Index = 0; Index < *HandleCount; Index++) {
+ for (Index = 0; Index < TempHandleCount; Index++) {
OriginalFmpImageInfoBuf = GetFmpImageDescriptors (
HandleBuffer[Index],
ProtocolGuid,
@@ -657,12 +658,21 @@ FindMatchingFmpHandles (
//
FmpImageInfoBuf = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *)(((UINT8 *)FmpImageInfoBuf) + DescriptorSize);
}
- if (!MatchFound) {
- HandleBuffer[Index] = NULL;
+ if (MatchFound) {
+ HandleBuffer[*HandleCount] = HandleBuffer[Index];
+ (*HandleCount)++;
}
FreePool (OriginalFmpImageInfoBuf);
}
+
+ if ((*HandleCount) == 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 = HandleBuffer[0];
Status = gBS->InstallMultipleProtocolInterfaces (
&HandleBuffer[0],
&gSystemFmpProtocolGuid,
--
2.7.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
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 <star.zeng@intel.com>; Kinney, Michael D > <michael.d.kinney@intel.com>; Yao, Jiewen <jiewen.yao@intel.com> > 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 <michael.d.kinney@intel.com> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng <star.zeng@intel.com> > --- > .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 21 > ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > > 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; > > *HandleCount = 0; > + TempHandleCount = 0; > HandleBuffer = NULL; > Status = gBS->LocateHandleBuffer ( > ByProtocol, > ProtocolGuid, > NULL, > - HandleCount, > + &TempHandleCount, > &HandleBuffer > ); > if (EFI_ERROR (Status)) { > - *HandleCount = 0; > return NULL; > } > > - for (Index = 0; Index < *HandleCount; Index++) { > + for (Index = 0; Index < TempHandleCount; Index++) { > OriginalFmpImageInfoBuf = GetFmpImageDescriptors ( > HandleBuffer[Index], > ProtocolGuid, > @@ -657,12 +658,21 @@ FindMatchingFmpHandles ( > // > FmpImageInfoBuf = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *)(((UINT8 > *)FmpImageInfoBuf) + DescriptorSize); > } > - if (!MatchFound) { > - HandleBuffer[Index] = NULL; > + if (MatchFound) { > + HandleBuffer[*HandleCount] = HandleBuffer[Index]; > + (*HandleCount)++; > } > > FreePool (OriginalFmpImageInfoBuf); > } > + > + if ((*HandleCount) == 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 = HandleBuffer[0]; > Status = gBS->InstallMultipleProtocolInterfaces ( > &HandleBuffer[0], > &gSystemFmpProtocolGuid, > -- > 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Star, Thanks for fixing these issues. Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Mike > -----Original Message----- > From: Yao, Jiewen > Sent: Sunday, April 15, 2018 6:49 PM > To: Zeng, Star <star.zeng@intel.com>; edk2- > devel@lists.01.org > Cc: Kinney, Michael D <michael.d.kinney@intel.com> > Subject: RE: [PATCH] SignedCapsulePkg > SystemFirmwareUpdateDxe: Fix failure caused by d69d922 > > 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 <star.zeng@intel.com>; Kinney, Michael > D > > <michael.d.kinney@intel.com>; Yao, Jiewen > <jiewen.yao@intel.com> > > 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 <michael.d.kinney@intel.com> > > Cc: Jiewen Yao <jiewen.yao@intel.com> > > Contributed-under: TianoCore Contribution Agreement > 1.1 > > Signed-off-by: Star Zeng <star.zeng@intel.com> > > --- > > .../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 = 0; > > + TempHandleCount = 0; > > HandleBuffer = NULL; > > Status = gBS->LocateHandleBuffer ( > > ByProtocol, > > ProtocolGuid, > > NULL, > > - HandleCount, > > + &TempHandleCount, > > &HandleBuffer > > ); > > if (EFI_ERROR (Status)) { > > - *HandleCount = 0; > > return NULL; > > } > > > > - for (Index = 0; Index < *HandleCount; Index++) { > > + for (Index = 0; Index < TempHandleCount; Index++) > { > > OriginalFmpImageInfoBuf = GetFmpImageDescriptors > ( > > HandleBuffer[Index], > > ProtocolGuid, > > @@ -657,12 +658,21 @@ FindMatchingFmpHandles ( > > // > > FmpImageInfoBuf = > (EFI_FIRMWARE_IMAGE_DESCRIPTOR *)(((UINT8 > > *)FmpImageInfoBuf) + DescriptorSize); > > } > > - if (!MatchFound) { > > - HandleBuffer[Index] = NULL; > > + if (MatchFound) { > > + HandleBuffer[*HandleCount] = > HandleBuffer[Index]; > > + (*HandleCount)++; > > } > > > > FreePool (OriginalFmpImageInfoBuf); > > } > > + > > + if ((*HandleCount) == 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 = HandleBuffer[0]; > > Status = gBS->InstallMultipleProtocolInterfaces > ( > > &HandleBuffer[0], > > &gSystemFmpProtocolGuid, > > -- > > 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.