* re: xfs: support inode btree blockcounts in online repair
@ 2020-09-11 11:16 Colin Ian King
2020-09-11 16:03 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2020-09-11 11:16 UTC (permalink / raw)
To: Darrick J. Wong, linux-xfs, Brian Foster; +Cc: linux-kernel@vger.kernel.org
Hi,
Static analysis with Coverity has detected an issue with the following
commit:
commit 30deae31eab501f568aadea45cfb3258b9e522f5
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date: Wed Aug 26 10:48:50 2020 -0700
xfs: support inode btree blockcounts in online repair
the analysis is as follows:
830 cur = xfs_inobt_init_cursor(mp, sc->tp, agi_bp,
sc->sa.agno,
831 XFS_BTNUM_FINO);
const: At condition error, the value of error must be equal to 0.
dead_error_condition: The condition error cannot be true.
832 if (error)
CID: Logically dead code (DEADCODE)dead_error_line: Execution cannot
reach this statement: goto err;.
833 goto err;
While it is tempting to change the if (error) check to if (cur), the
exit error path uses the errnoeous cur as follows:
842 err:
843 xfs_btree_del_cursor(cur, error);
844 return error;
so the error exit path needs some sorting out too.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: xfs: support inode btree blockcounts in online repair
2020-09-11 11:16 xfs: support inode btree blockcounts in online repair Colin Ian King
@ 2020-09-11 16:03 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-09-11 16:03 UTC (permalink / raw)
To: Colin Ian King; +Cc: linux-xfs, Brian Foster, linux-kernel@vger.kernel.org
On Fri, Sep 11, 2020 at 12:16:33PM +0100, Colin Ian King wrote:
> Hi,
>
> Static analysis with Coverity has detected an issue with the following
> commit:
>
> commit 30deae31eab501f568aadea45cfb3258b9e522f5
> Author: Darrick J. Wong <darrick.wong@oracle.com>
> Date: Wed Aug 26 10:48:50 2020 -0700
>
> xfs: support inode btree blockcounts in online repair
>
> the analysis is as follows:
>
> 830 cur = xfs_inobt_init_cursor(mp, sc->tp, agi_bp,
> sc->sa.agno,
> 831 XFS_BTNUM_FINO);
xfs_inobt_init_cursor can't return NULL (because we guarantee the
allocation cannot fail) so all that really needs to be done here is to
remove the pointless error check in lines 832-833.
--D
> const: At condition error, the value of error must be equal to 0.
> dead_error_condition: The condition error cannot be true.
>
> 832 if (error)
>
> CID: Logically dead code (DEADCODE)dead_error_line: Execution cannot
> reach this statement: goto err;.
>
> 833 goto err;
>
> While it is tempting to change the if (error) check to if (cur), the
> exit error path uses the errnoeous cur as follows:
>
> 842 err:
> 843 xfs_btree_del_cursor(cur, error);
> 844 return error;
>
> so the error exit path needs some sorting out too.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-11 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-11 11:16 xfs: support inode btree blockcounts in online repair Colin Ian King
2020-09-11 16:03 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox