diff mbox

xfs: fix uninitialized variable in xfs_scrub_quota

Message ID 8ac42102-7147-a373-5e2c-a984e1bdbe00@redhat.com (mailing list archive)
State Accepted
Headers show

Commit Message

Eric Sandeen Nov. 27, 2017, 10:57 p.m. UTC
On the first pass through the while(1) loop, we get to
xfs_scrub_should_terminate() which can test the uninitialized 
error variable.

Fixes-coverity-id: 1423737
Fixes: c2fc338c ("xfs: scrub quota information")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

compile-tested only


--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Darrick J. Wong Nov. 28, 2017, 2:20 a.m. UTC | #1
On Mon, Nov 27, 2017 at 04:57:36PM -0600, Eric Sandeen wrote:
> On the first pass through the while(1) loop, we get to
> xfs_scrub_should_terminate() which can test the uninitialized 
> error variable.
> 
> Fixes-coverity-id: 1423737
> Fixes: c2fc338c ("xfs: scrub quota information")
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok, will test...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

> ---
> 
> compile-tested only
> 
> diff --git a/fs/xfs/scrub/quota.c b/fs/xfs/scrub/quota.c
> index 8e58ba8..613def9 100644
> --- a/fs/xfs/scrub/quota.c
> +++ b/fs/xfs/scrub/quota.c
> @@ -207,7 +207,7 @@
>  	xfs_dqid_t			id = 0;
>  	uint				dqtype;
>  	int				nimaps;
> -	int				error;
> +	int				error = 0;
>  
>  	if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
>  		return -ENOENT;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/xfs/scrub/quota.c b/fs/xfs/scrub/quota.c
index 8e58ba8..613def9 100644
--- a/fs/xfs/scrub/quota.c
+++ b/fs/xfs/scrub/quota.c
@@ -207,7 +207,7 @@ 
 	xfs_dqid_t			id = 0;
 	uint				dqtype;
 	int				nimaps;
-	int				error;
+	int				error = 0;
 
 	if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
 		return -ENOENT;