Received: by 10.223.164.221 with SMTP id h29csp2086246wrb; Thu, 2 Nov 2017 05:46:26 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SkBd/N4O6zfOj2JPdtpLBlubp3z5kPH3D0UQ0N6Knm636qMWBYgI//Z077yUWS704sjgBR X-Received: by 10.99.97.151 with SMTP id v145mr3455529pgb.184.1509626786383; Thu, 02 Nov 2017 05:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509626786; cv=none; d=google.com; s=arc-20160816; b=wAVwyLZZyAKffqeI+hSyovEG5uPFoFz7cdtHUWaJG9tVXvBqQxtOXWUE8ORqnCE1X2 S67ojYxqDVUTVXhhMNnoPAjibtNF2mJONvE7G8joqvC5STcJv3fEEitOh4Bfg/IQAe6b IZA1SUrjX2urgd6YwllAmI/4ClU9AviwpCgld4/tEcweuozgEE4kLIDBNUzpXbBJInf/ 1ZGyxrfOhYp5N4DcFt2AHiWeMY81KE0HvCX/h7a0/hyXbzLWaLpSoJ/dE1sS/bFAii40 E3fImtAyhxNr8w6qnkQOxZRGa/+2u/NvMonNPU45TBPZ4UY9b/O7eFLgsZ+mAOzR9+/h oqAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=THztOBwhfCUzggORpsSmHRRLCoskii9DenCT0o73Y+w=; b=0FqtsxLMUm46PvxEmbldMJmVZ2/FamwqKi0BBBR24lkn+BwW2HdjAXEBNPGwIg956i xJvA0N6Mx+J6QaCP2SHbWKcVHUQSJ9NVmdTUIIqsAgzLqMvV1iJcIX0ijiZl87wrt8if b3p578BCw6YcO+cKCTOOTG2630Q2z9YGOV6ng1jIjtga0Ftn+aF/U29bimtzgKwUuFmC HvSFukKS3A6YNF4eRuszO2xTQoSPUAN8gj5GUsgxVJGa7cYwyBHl5LE2hPtUEjBbes+1 ZuamPHG2QdEnczrUR6O7MXrrvYAxKN+8/K1bcUNmi5B6/KRnrPn9NWT1AwzYebtNN1Jw ce4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64si3417620pgc.697.2017.11.02.05.46.12; Thu, 02 Nov 2017 05:46:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932833AbdKBMoD (ORCPT + 96 others); Thu, 2 Nov 2017 08:44:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751974AbdKBMoB (ORCPT ); Thu, 2 Nov 2017 08:44:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B378D5D68B; Thu, 2 Nov 2017 12:44:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B378D5D68B 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 Received: from bfoster.bfoster (dhcp-41-20.bos.redhat.com [10.18.41.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 957CA60460; Thu, 2 Nov 2017 12:44:01 +0000 (UTC) Received: by bfoster.bfoster (Postfix, from userid 1000) id 9EC70120147; Thu, 2 Nov 2017 08:44:00 -0400 (EDT) Date: Thu, 2 Nov 2017 08:44:00 -0400 From: Brian Foster To: Arnd Bergmann Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org, Dave Chinner , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] xfs: scrub: avoid uninitialized return code Message-ID: <20171102124359.GB16645@bfoster.bfoster> References: <20171102111137.3062126-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171102111137.3062126-1-arnd@arndb.de> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 02 Nov 2017 12:44:01 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 02, 2017 at 12:11:12PM +0100, Arnd Bergmann wrote: > 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] > > Returning -EINVAL might be an appropriate return code in this case. > > Fixes: 7c4a07a424c1 ("xfs: scrub directory/attribute btrees") > Signed-off-by: Arnd Bergmann > --- > fs/xfs/scrub/dabtree.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/scrub/dabtree.c b/fs/xfs/scrub/dabtree.c > index 4a93cf1753d3..971566388c9a 100644 > --- a/fs/xfs/scrub/dabtree.c > +++ b/fs/xfs/scrub/dabtree.c > @@ -349,8 +349,10 @@ xfs_scrub_da_btree_block( > > /* Check the pointer. */ > blk->blkno = blkno; > - if (!xfs_scrub_da_btree_ptr_ok(ds, level, blkno)) > + if (!xfs_scrub_da_btree_ptr_ok(ds, level, blkno)) { > + error = -EINVAL; > goto out_nobuf; > + } Hmm.. is an error really the right thing to do here vs. setting the context corrupt and returning 0? (Darrick..?) If the latter, perhaps error should just be initialized to 0. Brian > > /* Read the buffer. */ > error = xfs_da_read_buf(dargs->trans, dargs->dp, blk->blkno, -2, > -- > 2.9.0 > > -- > 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 From 1582952557462660820@xxx Thu Nov 02 11:13:18 +0000 2017 X-GM-THRID: 1582952557462660820 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread