* 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
* Re: staging: exfat: issue with FFS_MEDIAERR error return assignment
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
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2019-09-10 12:44 UTC (permalink / raw)
To: Colin Ian King; +Cc: Valdis Kletnieks, Greg Kroah-Hartman, devel, linux-kernel
On Fri, Aug 30, 2019 at 07:38:00PM +0100, Colin Ian King wrote:
> 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)
Idealy we would have both a filename and a function name but this email
doesn't have either so no one knows what code you are talking about. :P
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: staging: exfat: issue with FFS_MEDIAERR error return assignment
2019-09-10 12:44 ` Dan Carpenter
@ 2019-09-10 12:58 ` Colin Ian King
2019-09-10 13:09 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Colin Ian King @ 2019-09-10 12:58 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Valdis Kletnieks, Greg Kroah-Hartman, devel, linux-kernel
On 10/09/2019 13:44, Dan Carpenter wrote:
> On Fri, Aug 30, 2019 at 07:38:00PM +0100, Colin Ian King wrote:
>> 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)
>
> Idealy we would have both a filename and a function name but this email
> doesn't have either so no one knows what code you are talking about. :P
Oops, my bad.
drivers/staging/exfat/exfat_super.c ffsWriteStat()
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: staging: exfat: issue with FFS_MEDIAERR error return assignment
2019-09-10 12:58 ` Colin Ian King
@ 2019-09-10 13:09 ` Dan Carpenter
2019-09-10 13:18 ` Valdis Klētnieks
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2019-09-10 13:09 UTC (permalink / raw)
To: Colin Ian King; +Cc: devel, Greg Kroah-Hartman, Valdis Kletnieks, linux-kernel
On Tue, Sep 10, 2019 at 01:58:35PM +0100, Colin Ian King wrote:
> On 10/09/2019 13:44, Dan Carpenter wrote:
> > On Fri, Aug 30, 2019 at 07:38:00PM +0100, Colin Ian King wrote:
> >> 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)
> >
> > Idealy we would have both a filename and a function name but this email
> > doesn't have either so no one knows what code you are talking about. :P
>
> Oops, my bad.
>
> drivers/staging/exfat/exfat_super.c ffsWriteStat()
Yes, your solution is correct.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: staging: exfat: issue with FFS_MEDIAERR error return assignment
2019-09-10 13:09 ` Dan Carpenter
@ 2019-09-10 13:18 ` Valdis Klētnieks
0 siblings, 0 replies; 5+ messages in thread
From: Valdis Klētnieks @ 2019-09-10 13:18 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Colin Ian King, devel, Greg Kroah-Hartman, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]
On Tue, 10 Sep 2019 16:09:35 +0300, Dan Carpenter said:
> On Tue, Sep 10, 2019 at 01:58:35PM +0100, Colin Ian King wrote:
> > On 10/09/2019 13:44, Dan Carpenter wrote:
> > > On Fri, Aug 30, 2019 at 07:38:00PM +0100, Colin Ian King wrote:
> > >> 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)
> > >
> > > Idealy we would have both a filename and a function name but this email
> > > doesn't have either so no one knows what code you are talking about. :P
> >
> > Oops, my bad.
> >
> > drivers/staging/exfat/exfat_super.c ffsWriteStat()
>
> Yes, your solution is correct.
Actually, you can skip the else, because we initialized 'ret' at the start of the function.
The *bigger* issue - what should 'ret' be if dev_ejected is *false*?
[-- Attachment #2: Type: application/pgp-signature, Size: 832 bytes --]
^ 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).