linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* staging: exfat: issue with FFS_MEDIAERR error return assignment
@ 2019-08-30 18:38 Colin Ian King
  2019-09-10 12:44 ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Ian King @ 2019-08-30 18:38 UTC (permalink / raw)
  To: Valdis Kletnieks, Greg Kroah-Hartman, devel; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-10 13:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 18:38 staging: exfat: issue with FFS_MEDIAERR error return assignment Colin Ian King
2019-09-10 12:44 ` Dan Carpenter
2019-09-10 12:58   ` Colin Ian King
2019-09-10 13:09     ` Dan Carpenter
2019-09-10 13:18       ` Valdis Klētnieks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).