mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 00:32:38 +01:00 
			
		
		
		
	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
This commit is contained in:
		
							
								
								
									
										2
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user