Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lfs.c
diff options
context:
space:
mode:
authorColin Foster <colin.foster@in-advantage.com>2021-08-17 23:49:58 +0300
committerChristopher Haster <chaster@utexas.edu>2022-04-10 20:53:33 +0300
commitcf274e6ec62a26455caae0801c410f9bb8214ef3 (patch)
treedf73d7af0c5f782aa2fb78a9417ef2fe11ca706a /lfs.c
parent487df12dde704af32afb3c6488a8abe2d1c405d4 (diff)
Squash of CR changes
- nit: Moving brace to end of if statement line for consistency - mount: add more debug info per CR - Fix compiler error from extra parentheses - Fix superblock typo
Diffstat (limited to 'lfs.c')
-rw-r--r--lfs.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lfs.c b/lfs.c
index bd466b8..cbbc28b 100644
--- a/lfs.c
+++ b/lfs.c
@@ -3762,10 +3762,17 @@ 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) ||
- (superblock.block_size != lfs->cfg->block_size))
- {
- err = LFS_ERR_CORRUPT;
+ if (superblock.block_count != lfs->cfg->block_count) {
+ LFS_ERROR("Invalid block count (%"PRIu32" != %"PRIu32")",
+ superblock.block_count, lfs->cfg->block_count);
+ err = LFS_ERR_INVAL;
+ goto cleanup;
+ }
+
+ if (superblock.block_size != lfs->cfg->block_size) {
+ LFS_ERROR("Invalid block size (%"PRIu32" != %"PRIu32")",
+ superblock.block_count, lfs->cfg->block_count);
+ err = LFS_ERR_INVAL;
goto cleanup;
}
}