kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][xfs-next] xfs: fix uninitialized error variable
@ 2019-02-21 11:22 Colin King
  2019-02-21 15:54 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-02-21 11:22 UTC (permalink / raw)
  To: Darrick J . Wong, linux-xfs, Brian Foster, Dave Chinner
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

A previous commit removed the initialization of variable 'error' to zero,
and can cause a bogus error return.  This occurs when error contains a
non-zero garbage value and the call to xchk_should_terminate detects a
pending fatal signal and checks for a zero error before setting it
to -EAGAIN. Fix the issue by initializing error to zero.

Fixes: b9454fe056bd ("xfs: clean up the inode cluster checking in the inobt scrub")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/xfs/scrub/ialloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/scrub/ialloc.c b/fs/xfs/scrub/ialloc.c
index 2c9dad2b61b1..700114f79a7d 100644
--- a/fs/xfs/scrub/ialloc.c
+++ b/fs/xfs/scrub/ialloc.c
@@ -161,7 +161,7 @@ xchk_iallocbt_check_cluster_ifree(
 	bool				irec_free;
 	bool				ino_inuse;
 	bool				freemask_ok;
-	int				error;
+	int				error = 0;
 
 	if (xchk_should_terminate(bs->sc, &error))
 		return error;
-- 
2.20.1

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

* Re: [PATCH][xfs-next] xfs: fix uninitialized error variable
  2019-02-21 11:22 [PATCH][xfs-next] xfs: fix uninitialized error variable Colin King
@ 2019-02-21 15:54 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2019-02-21 15:54 UTC (permalink / raw)
  To: Colin King
  Cc: linux-xfs, Brian Foster, Dave Chinner, kernel-janitors,
	linux-kernel

On Thu, Feb 21, 2019 at 11:22:24AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> A previous commit removed the initialization of variable 'error' to zero,
> and can cause a bogus error return.  This occurs when error contains a
> non-zero garbage value and the call to xchk_should_terminate detects a
> pending fatal signal and checks for a zero error before setting it
> to -EAGAIN. Fix the issue by initializing error to zero.
> 
> Fixes: b9454fe056bd ("xfs: clean up the inode cluster checking in the inobt scrub")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thank you for the cleanup!

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/scrub/ialloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/scrub/ialloc.c b/fs/xfs/scrub/ialloc.c
> index 2c9dad2b61b1..700114f79a7d 100644
> --- a/fs/xfs/scrub/ialloc.c
> +++ b/fs/xfs/scrub/ialloc.c
> @@ -161,7 +161,7 @@ xchk_iallocbt_check_cluster_ifree(
>  	bool				irec_free;
>  	bool				ino_inuse;
>  	bool				freemask_ok;
> -	int				error;
> +	int				error = 0;
>  
>  	if (xchk_should_terminate(bs->sc, &error))
>  		return error;
> -- 
> 2.20.1
> 

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

end of thread, other threads:[~2019-02-21 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-21 11:22 [PATCH][xfs-next] xfs: fix uninitialized error variable Colin King
2019-02-21 15:54 ` 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;
as well as URLs for NNTP newsgroup(s).