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

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 30 Aug 2019 15:28:23 -0400

On Fri, Aug 30, 2019 at 3:26 PM Stephan Aßmus <superstippi@xxxxxx> wrote:


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.)

I think BFS does not allow partitions smaller than a few KB? Which is
an erroneous limit anyway (if you try to make a partition that size it
KDLs because there isn't enough space for the journal.)

-waddlesplash

Other related posts: