@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
@param SearchType Filter to find only files of this type.\r
Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
- @param VolumeHandle Handle of firmware volume in which to search.\r
+ @param FvHandle Handle of firmware volume in which to search.\r
@param FileHandle On entry, points to the current handle from which to begin searching or NULL to start\r
at the beginning of the firmware volume. On exit, points the file handle of the next file\r
in the volume or NULL if there are no more files.\r
EFI_PEI_FV_HANDLE ParentFvHandle;\r
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
EFI_FV_FILE_INFO FileInfo;\r
+ UINT64 FvLength;\r
\r
//\r
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already\r
//\r
// FvAlignment must be more than 8 bytes required by FvHeader structure.\r
//\r
- FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);\r
+ FvAlignment = 1 << ((ReadUnaligned32 (&FvHeader->Attributes) & EFI_FVB2_ALIGNMENT) >> 16);\r
if (FvAlignment < 8) {\r
FvAlignment = 8;\r
}\r
// Check FvImage\r
//\r
if ((UINTN) FvHeader % FvAlignment != 0) {\r
- NewFvBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINT32) FvHeader->FvLength), FvAlignment);\r
+ FvLength = ReadUnaligned64 (&FvHeader->FvLength);\r
+ NewFvBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINT32) FvLength), FvAlignment);\r
if (NewFvBuffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- CopyMem (NewFvBuffer, FvHeader, (UINTN) FvHeader->FvLength);\r
+ CopyMem (NewFvBuffer, FvHeader, (UINTN) FvLength);\r
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*) NewFvBuffer;\r
}\r
\r