]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/BootMonFs: Don't write file header to media until Flush
authorBrendan Jackman <brendan.jackman@arm.com>
Thu, 8 May 2014 15:04:16 +0000 (15:04 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 8 May 2014 15:04:16 +0000 (15:04 +0000)
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

ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c

index bf91bf0e1a86f0ef3980ee49210e97dd06199a49..7ef180f54a25d69857ccb9d0125482681c8392ab 100644 (file)
@@ -389,12 +389,8 @@ SetFileInfo (
   )\r
 {\r
   EFI_STATUS             Status;\r
-  EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
-  UINT8                 *DataBuffer;\r
-  UINTN                  BlockSize;\r
 \r
-  Status  = EFI_SUCCESS;\r
-  BlockIo = Instance->BlockIo;\r
+  Status = EFI_SUCCESS;\r
 \r
   // Note that a call to this function on a file opened read-only is only\r
   // invalid if it actually changes fields, so  we don't immediately fail if the\r
@@ -417,25 +413,6 @@ SetFileInfo (
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-\r
-    //\r
-    // Update the last block\r
-    //\r
-    BlockSize = BlockIo->Media->BlockSize;\r
-    DataBuffer = AllocatePool (BlockSize);\r
-    if (DataBuffer == NULL) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-    Status = BlockIo->ReadBlocks (BlockIo, Instance->Media->MediaId,\r
-        File->HwDescription.BlockEnd, BlockSize, DataBuffer);\r
-    if (EFI_ERROR (Status)) {\r
-      FreePool (DataBuffer);\r
-      return Status;\r
-    }\r
-    CopyMem (DataBuffer + BlockSize - sizeof (File->HwDescription), &File->HwDescription, sizeof (File->HwDescription));\r
-    Status = BlockIo->WriteBlocks (BlockIo, Instance->Media->MediaId,\r
-            File->HwDescription.BlockEnd, BlockSize, DataBuffer);\r
-    FreePool (DataBuffer);\r
   }\r
   return Status;\r
 }\r