Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed incorrect modulus in lfs_alloc_reset
Modulus of the offset by block_size was clearly a typo, and should be
block_count. Interesting to note that later moduluses during alloc
calculations prevents this from breaking anything, but as gtaska notes it
could skew the wear-leveling distribution.

Found by guiserle and gtaska
  • Loading branch information
geky committed Nov 20, 2020
commit 480cdd9f815d1d78caf98f22ed94ef4f58e46d0c
2 changes: 1 addition & 1 deletion lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static void lfs_alloc_ack(lfs_t *lfs) {
// Invalidate the lookahead buffer. This is done during mounting and
// failed traversals
static void lfs_alloc_reset(lfs_t *lfs) {
lfs->free.off = lfs->seed % lfs->cfg->block_size;
lfs->free.off = lfs->seed % lfs->cfg->block_count;
lfs->free.size = 0;
lfs->free.i = 0;
lfs_alloc_ack(lfs);
Expand Down