summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/DxeMain.h2
-rw-r--r--MdeModulePkg/Core/Dxe/FwVol/FwVol.c36
-rw-r--r--MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h21
3 files changed, 20 insertions, 39 deletions
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index f4db06d..75542b3 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -2595,6 +2595,8 @@ ReadFvbData (
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
@retval EFI_SUCCESS Successfully read volume header to the allocated
buffer.
+ @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
+ the file system could not be understood.
**/
EFI_STATUS
diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
index a7b272b..585d243 100644
--- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
@@ -173,6 +173,8 @@ ReadFvbData (
@retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
@retval EFI_SUCCESS Successfully read volume header to the allocated
buffer.
+ @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
+ the file system could not be understood.
**/
EFI_STATUS
@@ -200,6 +202,22 @@ GetFwVolHeader (
}
//
+ // Validate FV Header signature, if not as expected, continue.
+ //
+ if (TempFvh.Signature != EFI_FVH_SIGNATURE) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Check to see that the file system is indeed formatted in a way we can
+ // understand it...
+ //
+ if ((!CompareGuid (&TempFvh.FileSystemGuid, &gEfiFirmwareFileSystem2Guid)) &&
+ (!CompareGuid (&TempFvh.FileSystemGuid, &gEfiFirmwareFileSystem3Guid))) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
// Allocate a buffer for the caller
//
*FwVolHeader = AllocatePool (TempFvh.HeaderLength);
@@ -658,29 +676,11 @@ NotifyFwVolBlock (
}
ASSERT (FwVolHeader != NULL);
- //
- // Validate FV Header signature, if not as expected, continue.
- //
- if (FwVolHeader->Signature != EFI_FVH_SIGNATURE) {
- CoreFreePool (FwVolHeader);
- continue;
- }
-
if (!VerifyFvHeaderChecksum (FwVolHeader)) {
CoreFreePool (FwVolHeader);
continue;
}
-
- //
- // Check to see that the file system is indeed formatted in a way we can
- // understand it...
- //
- if ((!CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem2Guid)) &&
- (!CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid))) {
- continue;
- }
-
//
// Check if there is an FV protocol already installed in that handle
//
diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h b/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h
index 514c6ed..96cbde3 100644
--- a/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h
+++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h
@@ -405,25 +405,4 @@ IsValidFfsFile (
IN EFI_FFS_FILE_HEADER *FfsHeader
);
-
-/**
- given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
- copy the volume header into it.
-
- @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
- read the volume header
- @param FwVolHeader Pointer to pointer to allocated buffer in which
- the volume header is returned.
-
- @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
- @retval EFI_SUCCESS Successfully read volume header to the allocated
- buffer.
-
-**/
-EFI_STATUS
-GetFwVolHeader (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,
- OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
- );
-
#endif