All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_scrub: fix complaint about uninitialized ret
@ 2019-11-07 21:30 Darrick J. Wong
  2019-11-07 21:31 ` Eric Sandeen
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2019-11-07 21:30 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

Coverity complained about the uninitialized ret in run_scrub_phases.
It's not sophisticated enough to realize that phase 1 and 7 are both
marked mustrun and are never the repair or datascan dummies and that
therefore ret is always initialized by the end of the for loop, but
OTOH there's no reason not to fix a trivial logic bomb if that ever
changes.

Coverity-id: 1455255
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/xfs_scrub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index a792768c..014c54dd 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -422,7 +422,7 @@ run_scrub_phases(
 	unsigned int		debug_phase = 0;
 	unsigned int		phase;
 	int			rshift;
-	int			ret;
+	int			ret = 0;
 
 	if (debug_tweak_on("XFS_SCRUB_PHASE"))
 		debug_phase = atoi(getenv("XFS_SCRUB_PHASE"));

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

* Re: [PATCH] xfs_scrub: fix complaint about uninitialized ret
  2019-11-07 21:30 [PATCH] xfs_scrub: fix complaint about uninitialized ret Darrick J. Wong
@ 2019-11-07 21:31 ` Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2019-11-07 21:31 UTC (permalink / raw)
  To: Darrick J. Wong, Eric Sandeen; +Cc: xfs

On 11/7/19 3:30 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Coverity complained about the uninitialized ret in run_scrub_phases.
> It's not sophisticated enough to realize that phase 1 and 7 are both
> marked mustrun and are never the repair or datascan dummies and that
> therefore ret is always initialized by the end of the for loop, but
> OTOH there's no reason not to fix a trivial logic bomb if that ever
> changes.
> 
> Coverity-id: 1455255
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  scrub/xfs_scrub.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
> index a792768c..014c54dd 100644
> --- a/scrub/xfs_scrub.c
> +++ b/scrub/xfs_scrub.c
> @@ -422,7 +422,7 @@ run_scrub_phases(
>  	unsigned int		debug_phase = 0;
>  	unsigned int		phase;
>  	int			rshift;
> -	int			ret;
> +	int			ret = 0;
>  
>  	if (debug_tweak_on("XFS_SCRUB_PHASE"))
>  		debug_phase = atoi(getenv("XFS_SCRUB_PHASE"));
> 

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

end of thread, other threads:[~2019-11-07 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 21:30 [PATCH] xfs_scrub: fix complaint about uninitialized ret Darrick J. Wong
2019-11-07 21:31 ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.