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, From patchwork Thu Nov 2 11:11:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 117786 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1922326edm; Thu, 2 Nov 2017 04:12:05 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RAvu2LNNuwfob4G6FERNWiIwwi59ka0EJZAnQKiqk6SUkT1/AzW0akh1R7I5mAFj1rVPbn X-Received: by 10.98.74.149 with SMTP id c21mr3396890pfj.200.1509621125059; Thu, 02 Nov 2017 04:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509621125; cv=none; d=google.com; s=arc-20160816; b=tV1KnhXLb7AuAos4JaM3fyBdnAalJQ+rpzXjyP1w8sF4/ucatWZTgdhZQLsmkvDarK 847QOhZTFDvYDsBndQOjPRXCD+jm7BbVEm/35fF3yfiU0T98sM3lAFBJ9sv2fypAUO39 MsG6Wv11skE/UMPbn5nqtoKzMEHlfrCIkKYSuxldmIaecy58EF9JFBZnXAvpSzYVGvkM vSovSOTRQ3gR/bv75SG0MJFYt0lzRigciSyjbD48BAQZ3NFt964yfg8mJgwrNtaATN9W L+yiYbsO46isM1PnAj7jn7A6/tIEpuHr9E/aa53J0FYapsu433GbV7VovQYiEVmBEYZj vqpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=V3b6tgo9Vc2DO5Y/qKgDEKghJDyti+oPxXg9MvhqmAQ=; b=EvSngwvsdp8EREXqsTMhKGHiuPX1f8ATFvlnM6xKvYr0k4vjjZTJI5Foo/XRUwwpbE FoLSOQWCSphI2vZfS4eQrthBYNtIbC/L1Cz7XtU4OqulEfbpm+SZgxiDh+2+6utrIzPD WU4KJlRB6KDdVwb+K9bx5i97gT3Cj/HEKvi2qoKWIi4Bo1sYxBGg3FAR0Z3TJ/QgL3ad 7qd0VNEmX1/IV49XTt3lF6XwsBQWIR2KcsShCE8+80oa32uXnpz1zkt9DnyngSUOuG71 0rIo5dbM40M45bX/yxYxAt1DIALkPwlAhMLffa21LnAi144fgBl9No9lMxge7E4nOVQp KGPQ== 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.12.04; Thu, 02 Nov 2017 04:12:05 -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 S1755823AbdKBLMD (ORCPT + 26 others); Thu, 2 Nov 2017 07:12:03 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:58469 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755772AbdKBLL7 (ORCPT ); Thu, 2 Nov 2017 07:11:59 -0400 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0Li6Ex-1dNM7Y2279-00nRpa; Thu, 02 Nov 2017 12:11:51 +0100 From: Arnd Bergmann To: "Darrick J. Wong" Cc: Arnd Bergmann , linux-xfs@vger.kernel.org, Brian Foster , Dave Chinner , Eric Sandeen , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] xfs: fix unused variable warnings Date: Thu, 2 Nov 2017 12:11:13 +0100 Message-Id: <20171102111137.3062126-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171102111137.3062126-1-arnd@arndb.de> References: <20171102111137.3062126-1-arnd@arndb.de> X-Provags-ID: V03:K0:4TwVaRbn9b2zISKIa75ikUdrc8+JS2hIE/LJJja/NPEnuH5yPfP WLYtRCz3GjrG3zOEQh2zgnZOslkzmeIty4g7USJSQ6xjVpNqlywECSchJw8P3zzcfRSHhak v5+7DbqksdkARo3SvW0SGa4vhV/h7Xrj+uAefUP3ucMBjfNuzKRCwYVLFcBmYj3JZUt6MKj sMl5yymqUfqYdfixr9KuQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:KBRcH3K/SQc=:O38Kcud87NGuvK1zoqV2nH LyFQI9iK7gUFD1elAIK1ZwfGrZWsDAop10wHCZYDXc8ShpAgQTB6fgAgIs2cHELUl7x+t0cCY bHhSHpRANM3XkYQN/etW4Y8KL6WGGw5vDMaEY6Je4RaEZAcpjr6yYBGE/bT8FWwIUdFn8lNhh zgyRLNQ9T3QivSmpBMiAzZFS+JU6lHXOXksyRLPkiswVz5VP441eQK+5PIcArjb240Ks8rNzU 5BlBBsgg5GHz/x34kV5VtJ3c0TSN6Tq/6yQ2r1HGalW1HA9VNw6aNDPF4MgNATCcAjLf9Ab8x CM1vLVKy4S4ihSk2YRoKkpy4vbgKNhsfpbBmakpK++pBe4w3SF0UrC6lse+up7Vx1NvtIvNLJ ONxFrZMkro0omu1ZHgaXjBxG3QNm36LAK6zwOKA1xTkFsv2QUT/2uBsYjxOYpvzfTFibFVEOl inD68vpQSTz0qPwOeYaY8gi8yBGvuoeWlzL11YTqxw1sD+bLb0Xsx6JfqhJsnLJ7bWNtW7yFI HDFuuKiHzAVSm8wsMOGy/zoPgY489AMg2mlKsQAj3HU1ZW84G65oyJntebQeDT9M0dZ1SJIoX Dct3sUhhByl1aUBYY4P9WreJ6s/MJ75Gsh4BlTrwru0Hp6+3ia74xduUMbaFO7k7p+npKAQa2 bOr6W8/NkU5LL8HtpSjUWL1HobqDyblECLdzgw1874fU7k9qHWeKhiAgdO2BNRypNgxk/PY3Z Q4PoHJ3j8A+5Bfvuwu/+KhhliPy1JDoNqKKNtw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fs/xfs/libxfs/xfs_bmap.c: In function 'xfs_bmap_del_extent_delay': fs/xfs/libxfs/xfs_bmap.c:4648:20: error: unused variable 'ifp' [-Werror=unused-variable] struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); ^~~ fs/xfs/libxfs/xfs_bmap.c: In function 'xfs_bmap_del_extent_cow': fs/xfs/libxfs/xfs_bmap.c:4776:20: error: unused variable 'ifp' [-Werror=unused-variable] Fixes: ca5d8e5b7b90 ("xfs: move pre/post-bmap tracing into xfs_iext_update_extent") Signed-off-by: Arnd Bergmann --- fs/xfs/libxfs/xfs_bmap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.9.0 Reviewed-by: Brian Foster diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index f45f05c45e15..fa85b08b8fe2 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -4645,7 +4645,6 @@ xfs_bmap_del_extent_delay( struct xfs_bmbt_irec *del) { struct xfs_mount *mp = ip->i_mount; - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); struct xfs_bmbt_irec new; int64_t da_old, da_new, da_diff = 0; xfs_fileoff_t del_endoff, got_endoff; @@ -4663,7 +4662,7 @@ xfs_bmap_del_extent_delay( da_new = 0; ASSERT(*idx >= 0); - ASSERT(*idx <= xfs_iext_count(ifp)); + ASSERT(*idx <= xfs_iext_count(XFS_IFORK_PTR(ip, whichfork))); ASSERT(del->br_blockcount > 0); ASSERT(got->br_startoff <= del->br_startoff); ASSERT(got_endoff >= del_endoff); @@ -4773,7 +4772,6 @@ xfs_bmap_del_extent_cow( struct xfs_bmbt_irec *del) { struct xfs_mount *mp = ip->i_mount; - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); struct xfs_bmbt_irec new; xfs_fileoff_t del_endoff, got_endoff; int state = BMAP_COWFORK; @@ -4784,7 +4782,7 @@ xfs_bmap_del_extent_cow( got_endoff = got->br_startoff + got->br_blockcount; ASSERT(*idx >= 0); - ASSERT(*idx <= xfs_iext_count(ifp)); + ASSERT(*idx <= xfs_iext_count(XFS_IFORK_PTR(ip, XFS_COW_FORK))); ASSERT(del->br_blockcount > 0); ASSERT(got->br_startoff <= del->br_startoff); ASSERT(got_endoff >= del_endoff);