Skip to content

Commit eba423e

Browse files
committed
Squashed 'littlefs/' changes from 8e251dd..adad0fb
adad0fb Merge pull request #1140 from tjko/littlefs-toy ed12705 Merge pull request #1137 from dschendt/dschendt-fix-dir-count ec26996 Merge pull request #1134 from elupus/patch-2 17ab6e9 Merge pull request #1133 from elupus/patch-1 4cd2bfc Fixed inverted dir->count check logic f24ff9f Moved dir->count check before commit, limited to < 0xff f5b2226 Add littlefs-toy to the related projects section. 172a186 compact when dir count hits 0x3ff 8b75de7 fix: add missing return causing uninitialized reads 11cecd0 fix: also assert inside lfs_bd_read 8c7b6b2 fix: false uninitialized read warning git-subtree-dir: littlefs git-subtree-split: adad0fbbcf5382c20978d07f94f9c13be9041c1b
1 parent 4defaa6 commit eba423e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,11 @@ License Identifiers that are here available: http://spdx.org/licenses/
267267
to create images of the filesystem on your PC. Check if littlefs will fit
268268
your needs, create images for a later download to the target memory or
269269
inspect the content of a binary image of the target memory.
270-
270+
271+
- [littlefs-toy] - A command-line tool for creating and working with littlefs
272+
images. Uses syntax similar to tar command for ease of use. Supports working
273+
on littlefs images embedded inside another file (firmware image, etc).
274+
271275
- [littlefs2-rust] - A Rust wrapper for littlefs. This project allows you
272276
to use littlefs in a Rust-friendly API, reaping the benefits of Rust's memory
273277
safety and other guarantees.
@@ -321,6 +325,7 @@ License Identifiers that are here available: http://spdx.org/licenses/
321325
[littlefs-js]: https://github.com/geky/littlefs-js
322326
[littlefs-js-demo]:http://littlefs.geky.net/demo.html
323327
[littlefs-python]: https://pypi.org/project/littlefs-python/
328+
[littlefs-toy]: https://github.com/tjko/littlefs-toy
324329
[littlefs2-rust]: https://crates.io/crates/littlefs2
325330
[nim-littlefs]: https://github.com/Graveflo/nim-littlefs
326331
[chamelon]: https://github.com/yomimono/chamelon

lfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static int lfs_bd_read(lfs_t *lfs,
9393
// bypass cache?
9494
diff = lfs_aligndown(diff, lfs->cfg->read_size);
9595
int err = lfs->cfg->read(lfs->cfg, block, off, data, diff);
96+
LFS_ASSERT(err <= 0);
9697
if (err) {
9798
return err;
9899
}
@@ -739,6 +740,7 @@ static lfs_stag_t lfs_dir_getslice(lfs_t *lfs, const lfs_mdir_t *dir,
739740
int err = lfs_bd_read(lfs,
740741
NULL, &lfs->rcache, sizeof(ntag),
741742
dir->pair[0], off, &ntag, sizeof(ntag));
743+
LFS_ASSERT(err <= 0);
742744
if (err) {
743745
return err;
744746
}
@@ -767,6 +769,7 @@ static lfs_stag_t lfs_dir_getslice(lfs_t *lfs, const lfs_mdir_t *dir,
767769
err = lfs_bd_read(lfs,
768770
NULL, &lfs->rcache, diff,
769771
dir->pair[0], off+sizeof(tag)+goff, gbuffer, diff);
772+
LFS_ASSERT(err <= 0);
770773
if (err) {
771774
return err;
772775
}
@@ -1279,6 +1282,7 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs,
12791282
if (err == LFS_ERR_CORRUPT) {
12801283
break;
12811284
}
1285+
return err;
12821286
}
12831287

12841288
lfs_fcrc_fromle32(&fcrc);
@@ -2264,7 +2268,7 @@ static int lfs_dir_relocatingcommit(lfs_t *lfs, lfs_mdir_t *dir,
22642268
}
22652269
}
22662270

2267-
if (dir->erased) {
2271+
if (dir->erased && dir->count < 0xff) {
22682272
// try to commit
22692273
struct lfs_commit commit = {
22702274
.block = dir->pair[0],

0 commit comments

Comments
 (0)