ext2: accept block count until the disk size plus one
my understanding is that it's possible that the last block (for instance of size 4KB) is too large for the last few partition sectors, if the partition size isn't a multiple of the block size. Change-Id: I88c709d6e449aa52358fd9343c9f68f7ac1c01fe Reviewed-on: https://review.haiku-os.org/c/haiku/+/5399 Reviewed-by: Adrien Destugues <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
@@ -233,8 +233,10 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
status = opener.GetSize(&diskSize);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
if (diskSize < ((off_t)NumBlocks() << BlockShift()))
|
||||
if ((diskSize + fBlockSize) <= ((off_t)NumBlocks() << BlockShift())) {
|
||||
FATAL("diskSize is too small for the number of blocks!\n");
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
fBlockCache = opener.InitCache(NumBlocks(), fBlockSize);
|
||||
if (fBlockCache == NULL)
|
||||
|
||||
Reference in New Issue
Block a user