From dcaf7c9012df9fb19b60454c9688d457e5fe2dc1 Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Thu, 8 May 2014 15:04:16 +0000 Subject: 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 Reviewed-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15514 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c | 25 +--------------------- 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'ArmPlatformPkg') diff --git a/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c b/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c index bf91bf0e1a..7ef180f54a 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; } -- cgit v1.2.3