summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Jackman <brendan.jackman@arm.com>2014-05-08 15:04:16 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-05-08 15:04:16 +0000
commitdcaf7c9012df9fb19b60454c9688d457e5fe2dc1 (patch)
treedbbf503d4fce37a78160ea82a92fde0891305993
parent35d3b52ddd168318892f8598611e6544b3f5a545 (diff)
ArmPlatformPkg/BootMonFs: Don't write file header to media until Flush
This prevents writing to a garbage location if the file has not been flushed before, as its BlockStart and BlockEnd are not set. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brendan Jackman <brendan.jackman@arm.com> Reviewed-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15514 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
index bf91bf0e1..7ef180f54 100644
--- a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
+++ b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
@@ -389,12 +389,8 @@ SetFileInfo (
)
{
EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- UINT8 *DataBuffer;
- UINTN BlockSize;
- Status = EFI_SUCCESS;
- BlockIo = Instance->BlockIo;
+ Status = EFI_SUCCESS;
// Note that a call to this function on a file opened read-only is only
// invalid if it actually changes fields, so we don't immediately fail if the
@@ -417,25 +413,6 @@ SetFileInfo (
if (EFI_ERROR (Status)) {
return Status;
}
-
- //
- // Update the last block
- //
- BlockSize = BlockIo->Media->BlockSize;
- DataBuffer = AllocatePool (BlockSize);
- if (DataBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- Status = BlockIo->ReadBlocks (BlockIo, Instance->Media->MediaId,
- File->HwDescription.BlockEnd, BlockSize, DataBuffer);
- if (EFI_ERROR (Status)) {
- FreePool (DataBuffer);
- return Status;
- }
- CopyMem (DataBuffer + BlockSize - sizeof (File->HwDescription), &File->HwDescription, sizeof (File->HwDescription));
- Status = BlockIo->WriteBlocks (BlockIo, Instance->Media->MediaId,
- File->HwDescription.BlockEnd, BlockSize, DataBuffer);
- FreePool (DataBuffer);
}
return Status;
}