From patchwork Thu Nov 2 11:11:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 117785 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1922144edm; Thu, 2 Nov 2017 04:11:55 -0700 (PDT) X-Google-Smtp-Source: ABhQp+ThugHPUIUwRchKUpCIP91aRGNEjWwTO27BS7gTiS6wgYP375C6MJOsai4/v1eeHvjXlAv7 X-Received: by 10.101.80.195 with SMTP id s3mr3145732pgp.19.1509621115542; Thu, 02 Nov 2017 04:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509621115; cv=none; d=google.com; s=arc-20160816; b=oFAWLtuQ/md6fxvWxJGVs4Y0YkO6irFA6JdnivehvB5v2kJcapP56VzJSnr9ICErgs 02cEsYOlJ72mIbAFlpV1+Jvmek5klqI1KAPKrl+ans41klbnqLIYCkbHWWFhLX4BHvwj SAg5qi8tmylEswDpc6m7tq2V/0BBngH8s/Qj3rrUnhGfUX7tEmt1CyRfQz6zrZTk8kl3 6Ur5BVt3SPoqF7X44Ibio1xINFtFWAc2bw3JbYSx6O6D80lsRs897FOfaaSoa7cho0/R 94vyylGDmm4oJeNYYIRjvqqSG/BIm1Wc+HXDb7C9ZVFX8R/OpFoNh2wJW7bEfJerXf+T ql1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=eu7JxC3o4Oddd9hweVldSnnTcmsxi00kU4jAJj/Ybxw=; b=ckVf99qtqGVBOwZ8hCoAw2cJ0JN+3xsbP1zez4b8WXxdOetWiChEdBzxq9MRIUu34+ TbD0gaaQV3I5DnDT9hT1eokoQdpUWpnUabd0FicSK/KWM53Djj23bQEYbnyxrwZ+DfXw 6raozinG6MCLYdCaL3dMVmdJiw4dzDEHoLO2P50yZdjXXyM0ESQt9PDkjaRX3Q9Cci0u FenYGly4Q6lPzHYtwnfqW7ubnhkSk6A+J+j6j5Yki63GYeJ8Z2APivT9ayydo0J8v1Bu E6vWFU/J9SyNin4rp1dOjw8BpJmp4WnCjo5f1uku2uJLKjjtOBKlbqXOQJJvNhSdzOuz EvOQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z7si3195248pgp.592.2017.11.02.04.11.55; Thu, 02 Nov 2017 04:11:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755747AbdKBLLw (ORCPT + 26 others); Thu, 2 Nov 2017 07:11:52 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:59371 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755224AbdKBLLr (ORCPT ); Thu, 2 Nov 2017 07:11:47 -0400 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lpljf-1dXHlF3UHP-00fmqs; Thu, 02 Nov 2017 12:11:38 +0100 From: Arnd Bergmann To: "Darrick J. Wong" Cc: Arnd Bergmann , linux-xfs@vger.kernel.org, Dave Chinner , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] xfs: scrub: avoid uninitialized return code Date: Thu, 2 Nov 2017 12:11:12 +0100 Message-Id: <20171102111137.3062126-1-arnd@arndb.de>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w6da/UBmWJ7T5Ylwa2caAkMpGiRP1g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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; + } /* Read the buffer. */ error = xfs_da_read_buf(dargs->trans, dargs->dp, blk->blkno, -2,