julianoes opened a new pull request, #17706:
URL: https://github.com/apache/nuttx/pull/17706

   ## Summary
   
   `lfs_fs_size()` can return more blocks than block_count during active writes 
due to copy-on-write blocks. This caused f_bavail to underflow to a large 
positive number. Add clamping to prevent this.
   
   In my case, this lead to `statfs` to return negative/bogus numbers. With the 
fix `statfs` will return `0` available too early but that's - in my opinion - 
the lesser problem.
   
   ## Impact
   
   I wouldn't think this should break anything, unless someone relies on 
`f_bfree` or `f_avail` which are `uint32_t` or `uint64_t` to become 
negative/very big.
   
   ## Testing
   
   Tested using:
   - Board with STM32H743
   - W25N01GV on SPI at 96 MHz with DMA enabled
   - Flash mounted using littlefs 2.5.1
   - Writing files using PX4 logger.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to