Skip to content

Commit

Permalink
Fail when block_size doesn't match config
Browse files Browse the repository at this point in the history
With the previous commit, fail if the superblock block_size doesn't
match the config block_size.
  • Loading branch information
colin-foster-in-advantage committed Aug 17, 2021
1 parent 3efb8e4 commit 487df12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3762,7 +3762,8 @@ static int lfs_rawmount(lfs_t *lfs, const struct lfs_config *cfg) {
lfs->attr_max = superblock.attr_max;
}

if (superblock.block_count != lfs->cfg->block_count)
if ((superblock.block_count != lfs->cfg->block_count) ||
(superblock.block_size != lfs->cfg->block_size))
{
err = LFS_ERR_CORRUPT;
goto cleanup;
Expand Down

0 comments on commit 487df12

Please sign in to comment.