From 487df12dde704af32afb3c6488a8abe2d1c405d4 Mon Sep 17 00:00:00 2001 From: Colin Foster Date: Tue, 17 Aug 2021 10:02:27 -0700 Subject: [PATCH] Fail when block_size doesn't match config With the previous commit, fail if the superblock block_size doesn't match the config block_size. --- lfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lfs.c b/lfs.c index c0092ca..bd466b8 100644 --- a/lfs.c +++ b/lfs.c @@ -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;