From patchwork Wed Oct 18 07:36:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10013913 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 AE11860215 for ; Wed, 18 Oct 2017 07:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A03B428AFE for ; Wed, 18 Oct 2017 07:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9455228B00; Wed, 18 Oct 2017 07:37:55 +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, UNPARSEABLE_RELAY 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 279D828AFE for ; Wed, 18 Oct 2017 07:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935672AbdJRHhv (ORCPT ); Wed, 18 Oct 2017 03:37:51 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:36813 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932293AbdJRHhu (ORCPT ); Wed, 18 Oct 2017 03:37:50 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9I7aiEh016045 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Oct 2017 07:36:44 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v9I7ag4a014170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Oct 2017 07:36:43 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v9I7ag67026069; Wed, 18 Oct 2017 07:36:42 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Oct 2017 00:36:42 -0700 Date: Wed, 18 Oct 2017 10:36:35 +0300 From: Dan Carpenter To: Chris Mason , Josef Bacik Cc: David Sterba , linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree() Message-ID: <20171018073635.cajusx7hzkg4ghgc@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP read_tree_block() returns error pointers, and never NULL and so I have updated the error handling. Fixes: 74739121b4c7 ("Btrfs: add a extent ref verify tool") Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c index f65d78cf3c7e..34878699d363 100644 --- a/fs/btrfs/ref-verify.c +++ b/fs/btrfs/ref-verify.c @@ -584,7 +584,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path, gen = btrfs_node_ptr_generation(path->nodes[level], path->slots[level]); eb = read_tree_block(fs_info, block_bytenr, gen); - if (!eb || !extent_buffer_uptodate(eb)) { + if (IS_ERR(eb)) + return PTR_ERR(eb); + if (!extent_buffer_uptodate(eb)) { free_extent_buffer(eb); return -EIO; }