From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934354AbdKBT5n (ORCPT ); Thu, 2 Nov 2017 15:57:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932497AbdKBT5l (ORCPT ); Thu, 2 Nov 2017 15:57:41 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 91B8F5D685 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=bfoster@redhat.com Date: Thu, 2 Nov 2017 15:57:39 -0400 From: Brian Foster To: "Darrick J. Wong" Cc: Arnd Bergmann , linux-xfs@vger.kernel.org, Dave Chinner , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] xfs: scrub: avoid uninitialized return code Message-ID: <20171102195739.GK16645@bfoster.bfoster> References: <20171102195306.GA4911@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171102195306.GA4911@magnolia> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 02 Nov 2017 19:57:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 02, 2017 at 12:53:06PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong > > The newly added xfs_scrub_da_btree_block() function has one code path > that returns the 'error' variable without initializing it first, as > shown by this compiler warning: > > fs/xfs/scrub/dabtree.c: In function 'xfs_scrub_da_btree_block': > fs/xfs/scrub/dabtree.c:462:9: error: 'error' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > Return zero since the caller will exit the scrub code if we don't produce a > buffer pointer. > > Fixes: 7c4a07a424c1 ("xfs: scrub directory/attribute btrees") > Reported-by: Arnd Bergmann > Signed-off-by: Darrick J. Wong > --- Reviewed-by: Brian Foster > fs/xfs/scrub/dabtree.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/xfs/scrub/dabtree.c b/fs/xfs/scrub/dabtree.c > index c21c528..4c9839c 100644 > --- a/fs/xfs/scrub/dabtree.c > +++ b/fs/xfs/scrub/dabtree.c > @@ -336,7 +336,7 @@ xfs_scrub_da_btree_block( > xfs_ino_t owner; > int *pmaxrecs; > struct xfs_da3_icnode_hdr nodehdr; > - int error; > + int error = 0; > > blk = &ds->state->path.blk[level]; > ds->state->path.active = level + 1;