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
diff options
context:
space:
mode:
authorBrian Pugh <bnp117@gmail.com>2023-08-18 01:07:19 +0300
committerBrian Pugh <bnp117@gmail.com>2023-08-18 01:07:19 +0300
commit6de3fc6ae84057062f5859b3446a33319d5c70e3 (patch)
treedbd1f2eeb454901bd11db6463d216a91e0b36775
parentdf238ebac6adb7f0111af757e79df104f64d9963 (diff)
fix corruption check
-rw-r--r--lfs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lfs.c b/lfs.c
index 2bb7fe7..16295f2 100644
--- a/lfs.c
+++ b/lfs.c
@@ -46,8 +46,7 @@ static int lfs_bd_read(lfs_t *lfs,
lfs_block_t block, lfs_off_t off,
void *buffer, lfs_size_t size) {
uint8_t *data = buffer;
- if (lfs->block_count &&
- (block >= lfs->block_count || off+size > lfs->cfg->block_size)) {
+ if (off+size > lfs->cfg->block_size || (lfs->block_count && block >= lfs->block_count)) {
return LFS_ERR_CORRUPT;
}