staging: exfat: issue with FFS_MEDIAERR error return assignment
From: Colin Ian King
Date: Fri Aug 30 2019 - 14:38:04 EST
Hi,
Static analysis on exfat with Coverity has picked up an assignment of
FFS_MEDIAERR that gets over-written:
1750 if (is_dir) {
1751 if ((fid->dir.dir == p_fs->root_dir) &&
1752 (fid->entry == -1)) {
1753 if (p_fs->dev_ejected)
CID 85797 (#1 of 1): Unused value (UNUSED_VALUE)
Assigning value 1 to ret here, but that stored value is overwritten
before it can be used.
1754 ret = FFS_MEDIAERR;
value_overwrite: Overwriting previous write to ret with value 0.
1755 ret = FFS_SUCCESS;
1756 goto out;
1757 }
1758 }
I doubt that's intentional, should it be instead the following?
if (p_fs->dev_ejected)
ret = FFS_MEDIAERR;
else
ret = FFS_SUCCESS;
goto out;
Colin