Kaynağa Gözat

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
Christopher Haster 5 yıl önce
ebeveyn
işleme
480cdd9f81
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      lfs.c

+ 1 - 1
lfs.c

@@ -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);