[haiku-commits] Re: haiku: hrev53429 - in src/add-ons/kernel/file_systems: ext2 bfs

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 30 Aug 2019 21:26:47 +0200

Hi,

Am 30.08.2019 um 21:18 schrieb waddlesplash:

diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.cpp 
b/src/add-ons/kernel/file_systems/bfs/Volume.cpp
index ca3241fd24..2b06068c3f 100644
--- a/src/add-ons/kernel/file_systems/bfs/Volume.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/Volume.cpp
@@ -828,8 +828,12 @@ Volume::_EraseUnusedBootBlock()
  {
        const int32 blockSize = 512;
        const char emptySector[blockSize] = { 0 };
+       // Erase boot block if any
        if (write_pos(fDevice, 0, emptySector, blockSize) != blockSize)
                return B_IO_ERROR;
+       // Erase ext2 superblock if any
+       if (write_pos(fDevice, 1024, emptySector, blockSize) != blockSize)
+               return B_IO_ERROR;

Is it OK to just write at an offset without checking the partition size?
What if the partition is smaller than that? (I know it doesn't make much
sense for it to be smaller, but still.)

Best regards,
-Stephan

Other related posts: