Hey @JoelSherrill @gedare ,
I went through the reported Coverity findings and traced the relevant code paths in the current FatFs integration. I have included a brief overview of my analysis and attached relevant pdfs for your reference. Let me know if you have any questions. I have replied accordingly for the related issue.
I would advice contacting the author if he is available through mailing : user5@elm-chan.org, Since this was the only source of contact I could find for now.
The RTEMS Issue which was detected was already fixed by commit 01f88b058f which added an explicit cast (uint32_t) presented below
inode_hash ^= fno->fsize ^ ((uint32_t) fno->fdate << 16) ^ fno->ftime;
- Coverity false positives: 1668653, 1668652, 1668650, 1668648, 1668646, 1668644
- RTEMS issue, already fixed: 1668651
- Upstream FatFs issues: 1668649, 1668647, 1668645
| CID | Classification | Brief overview |
|---|---|---|
| 1668653 | Coverity false positive | f_getcwd() passes a partially initialized FFOBJID, but the uninitialized fields reported by Coverity are only accessed in the exFAT path, while the reported path is FAT/FAT32. |
| 1668652 | Coverity false positive | f_rename() copies DIR structures containing an uninitialized obj.id, but id is not consumed along this execution path; validate() is not called by follow_path(). |
| 1668651 | RTEMS issue – already fixed | The signed-extension warning on fdate << 16 was a genuine RTEMS integration issue; the explicit (uint32_t) cast has already been added in a later RTEMS commit. |
| 1668650 | Coverity false positive | create_partition() can legitimately wrap the BYTE variable n_hd from 128 to 0 when doubling it to 256, making the n_hd == 0 fallback reachable. |
| 1668649 | Upstream FatFs issue | f_rename() ignores the return value of get_ldnumber() for the new path, so an invalid logical drive can go unchecked instead of returning FR_INVALID_DRIVE. |
| 1668648 | Coverity false positive | f_getfree() passes a partially initialized FFOBJID, but the reported uninitialized exFAT fields are not accessed because the call is explicitly inside the FAT12 path. |
| 1668647 | Upstream FatFs issue | In f_unlink(), sdj.obj.n_frag is not initialized before an exFAT get_fat() path can consume it when stat == 0; objsize is initialized and n_cont is not reachable in the reported state. |
| 1668646 | Coverity false positive | get_fileinfo() can write at most 11 SFN characters plus one . (12 characters); altname has 13 elements, leaving index 12 for the terminating NUL. |
| 1668645 | Upstream FatFs issue | f_mkdir() ignores the return value of remove_chain() when cleaning up an allocated cluster after directory creation fails; cleanup can itself return disk/internal errors. |
| 1668644 | Coverity false positive | obj->objsize - 1 can technically wrap when objsize == 0, but in that state clen cannot be used by the stat == 2 branch, so the overflow has no behavioral effect. |
I
Investigation_CID_1668651.pdf (152.6 KB)
Investigation_CID_1668649.pdf (159.1 KB)
Investigation_CID_1668647.pdf (175.9 KB)
Investigation_CID_1668645.pdf (141.2 KB)