jlaitine opened a new pull request, #11433: URL: https://github.com/apache/nuttx/pull/11433
## Summary Fix the issue where fat driver is not using the last two clusters in the file system. The fat parameter fs->fs_nclusters is the maximum number of data clusters; this doesn't include the two in the beginning. Many checks in the fat driver treat the fs->fs_nclusters-1 as being the last accessible cluster, which is not right, the last accessible one is actually this number + 2 when the cluster count includes the two first ones. Normally this is not an issue when writes are being done through the same driver, the last two clusters are just never used. But if the filesystem is modified by external driver, for example with a populated fat created with PC, or modifying the FS via USB-MSC, this leads to the fat driver not being able to read anything that uses the last two clusters. ## Impact For us this fixes an issue with reading an externally created FAT filesystem in NuttX ## Testing Limited testing done so far, creating FAT16 and FAT32 filesystems over usb-msc into an eMMC on a NuttX device, and writing files on them. In NuttX, reading the files and monitoring that with the original code the files occupying the last 2 clusters in the FS cannot be read. With this fix, the files are readable. Also compared the file system information gotten with linux "fatcat" over usb-msc to the information extracted in fs/fat/fs_fat32util.c that those match -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org