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: 10038481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 28A7E60291 for ; Thu, 2 Nov 2017 11:12:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EF3D28F01 for ; Thu, 2 Nov 2017 11:12:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 136AF28F05; Thu, 2 Nov 2017 11:12:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B863F28F01 for ; Thu, 2 Nov 2017 11:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755330AbdKBLLt (ORCPT ); Thu, 2 Nov 2017 07:11:49 -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> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:VRGXQ6OOGbrQpeYDFSs5PTkvM85MFSe12d/tlxXZAusdyNd/wzT Q2f9InnYHYLNq8CHQNmHF65ncKKRrkwCaVqGTvZIoP7tYjzzBTOgWFKxAAwmdUUhEdlwxhT 2Ye/IN36NA7CfU+lz+Zd9kxMbgKQpLYF2zUAQTQuZinGhEejvmAoY9LgJVMQDh0xQsCDz57 0YfW+wb5osA6x/AJ/PqQw== X-UI-Out-Filterresults: notjunk:1; V01:K0:g3HFrY+amfE=:BGhb4VxIm2rkQhBp3WA8AY P46APE0HKLMlp4jli1wHoXFJpUFjETwXcMVtNdd8rT9ENOx4vLc7Z7BiHKLRlrR0/zOXBPwoW 2q/pjOJ7h1iqWkX/EUIpT0mIIRhKWddFVKUOpGUG8jQ++Mvf6bOe9CuEMTzC7WaWYEnXUnLQZ u/5+4mOmyjy829q3BbjW9ISr7xvNiHhsqPSoqr8TQ1ltDhb/qlLQodZ7DUitqRgyOtwucZC1W vGBhhPpxroL0ho31RmeEhUb0quFORqRX+++dZlnjkezwCFM1PX9EqqYS2PMqTU3MGNDwh9mli MgBMFElRyP2Zhvu4+Nw1NVps0gLyXokSWFl2qHgWezkUS1VTcJhMWEua0gN7IKWVVGxFZ/FMw d+eLQHYwVcBGcSTKYaRmfnmjJFQGhKDLfkY4bClu+oQh5KTWaj/PBQumWw0F4qeK77bCf+A3Z Wc+Vm76b8DCRBOX8ODye9CcwdqVnwbfBjR8khfG1jIMg1ffYtsAi62OCGsGSX6MvJTrrPri0i ORWJo0Me04BEuB1Fa0BZBzCgyWg9OrCLfqFNBoV8fUsMb+C1HNAX1f3TdJ+82bL6hH2Yc1dBp G62hb9A4pm9nMYJoDaIGrYvksSFKzabDa6FLfUJn4wTk/i8orcHINR/CEeygT/tW+OLnjtRZT Gf4PFbbl8qbRivOY6OtY3Z7S+AKFcOMZOV0VYnYRMvpb60GJsK+wKTDxnOhfCdu7jWbDgm84I Vn3nc0ZPw6da/UBmWJ7T5Ylwa2caAkMpGiRP1g== Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; + } /* Read the buffer. */ error = xfs_da_read_buf(dargs->trans, dargs->dp, blk->blkno, -2,