diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-25 09:56:20 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-25 09:56:20 +0000 |
commit | b4d856a6b52a724e7cf04653f3049a47641a9f39 (patch) | |
tree | c7b3d204df630f44b2ec82d25ab985140672ebef | |
parent | 52cbe449189fa6944e2a68e52ec04628896daf19 (diff) | |
download | edk2-platforms-b4d856a6b52a724e7cf04653f3049a47641a9f39.tar.xz |
Fix the issue that accessing for unaligned address break IPF
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9809 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Core/Pei/FwVol/FwVol.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index cab1cdb001..d2bd6c493e 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -853,6 +853,7 @@ ProcessFvFile ( EFI_PEI_FV_HANDLE ParentFvHandle;
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
EFI_FV_FILE_INFO FileInfo;
+ UINT64 FvLength;
//
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
@@ -890,7 +891,7 @@ ProcessFvFile ( //
// FvAlignment must be more than 8 bytes required by FvHeader structure.
//
- FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
+ FvAlignment = 1 << ((ReadUnaligned32 (&FvHeader->Attributes) & EFI_FVB2_ALIGNMENT) >> 16);
if (FvAlignment < 8) {
FvAlignment = 8;
}
@@ -899,11 +900,12 @@ ProcessFvFile ( // Check FvImage
//
if ((UINTN) FvHeader % FvAlignment != 0) {
- NewFvBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINT32) FvHeader->FvLength), FvAlignment);
+ FvLength = ReadUnaligned64 (&FvHeader->FvLength);
+ NewFvBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINT32) FvLength), FvAlignment);
if (NewFvBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- CopyMem (NewFvBuffer, FvHeader, (UINTN) FvHeader->FvLength);
+ CopyMem (NewFvBuffer, FvHeader, (UINTN) FvLength);
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*) NewFvBuffer;
}
|