staging: exfat: issue with FFS_MEDIAERR error return assignment

Colin Ian King colin.king at canonical.com
Fri Aug 30 18:38:00 UTC 2019


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


More information about the devel mailing list