diff mbox series

[edk2,RFC,edk2-platforms,2/6] Silicon/SynQuacerPlatformFlashAccessLib: don't dereference FVB header fields

Message ID 20180316161322.6756-3-ard.biesheuvel@linaro.org
State New
Headers show
Series expand capsule to include SCP firmware | expand

Commit Message

Ard Biesheuvel March 16, 2018, 4:13 p.m. UTC
When we updated the capsule definition to cover the ARM Trusted Firmware
binary image as well as the firmware volume containing the EDK2 code, we
failed to recognize that the start of the image no longer constitutes a
Firmware Volume header, and so we should not interpret the data as such.

Note that this makes the FVB protocol slighty less appropriate as the
abstraction to use to write this data, but given that there does not
appear to be a better match (disk I/O, block I/O), let's stick with it
for now, but require the base address to match the capsule's target
address exactly rather than reading the size of the FV from the header.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

-- 
2.15.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
index 1af4abc16aa5..82fe3f74aa7f 100644
--- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
+++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
@@ -53,7 +53,6 @@  GetFvbByAddress (
   UINTN                               HandleCount;
   UINTN                               Index;
   EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *Fvb;
-  EFI_FIRMWARE_VOLUME_HEADER          *FwVolHeader;
   EFI_FVB_ATTRIBUTES_2                Attributes;
 
   //
@@ -103,8 +102,7 @@  GetFvbByAddress (
       continue;
     }
 
-    FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) *FvbBaseAddress);
-    if ((Address >= *FvbBaseAddress) && (Address <= (*FvbBaseAddress + FwVolHeader->FvLength))) {
+    if (Address == *FvbBaseAddress) {
       *OutFvb  = Fvb;
       Status   = EFI_SUCCESS;
       break;