From patchwork Wed Jul 3 16:32:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 2818031 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5EF0D9F3C3 for ; Wed, 3 Jul 2013 16:33:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C34F2018E for ; Wed, 3 Jul 2013 16:33:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED4A12017B for ; Wed, 3 Jul 2013 16:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932589Ab3GCQdF (ORCPT ); Wed, 3 Jul 2013 12:33:05 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:43307 "EHLO mail-we0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932202Ab3GCQdE (ORCPT ); Wed, 3 Jul 2013 12:33:04 -0400 Received: by mail-we0-f173.google.com with SMTP id x54so309026wes.32 for ; Wed, 03 Jul 2013 09:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=Sp2JAael0ZWsszc/xH9gypRkJPtHwVBVpczF/veNWvw=; b=TdeNiGSGT3FbUp1uIzZoe2KA8fUqZW1xD3E0DICRvLEjNgJabrdd4koQBgL0sm6hrw rLTLD6p6abRRdvECN4/GIprORTw0Fy4WAeyeevqJA1oSoOPScekYWDKwmiNv8bufzhX1 zEgm5qTAxCw5QfBkjOeCS2HEU+NPYGQwJ41Uyogj1bgpSWYflQfTtIx+JF3tb0LjKOpx w3kWp8HE/QLcTXvnjzXzIfbz0IsPo4UVes8JaCZlMu3A2yzFBtVPYM1Hy3P4lIVa2AV6 YkRR6yovmtllaVHQDXlQtFgeidzhOo5AB6ypiD178J5lgW6z6vXm1rhvTp3Pf45w1lD1 NlpQ== X-Received: by 10.180.73.68 with SMTP id j4mr2555622wiv.10.1372869182186; Wed, 03 Jul 2013 09:33:02 -0700 (PDT) Received: from storm-desktop.lan (bl11-92-143.dsl.telepac.pt. [85.244.92.143]) by mx.google.com with ESMTPSA id o10sm27587519wiz.5.2013.07.03.09.33.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Jul 2013 09:33:01 -0700 (PDT) From: Filipe David Borba Manana To: linux-btrfs@vger.kernel.org Cc: Filipe David Borba Manana Subject: [PATCH] Btrfs-progs: fix check in btrfs_lookup_extent_info() Date: Wed, 3 Jul 2013 17:32:53 +0100 Message-Id: <1372869173-15043-1-git-send-email-fdmanana@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We want to test if path->slots[0] is greater than zero. Testing for path->slots was a logical error, as it corresponds to a memory address (start of fixed array) and therefore is always non-zero. Signed-off-by: Filipe David Borba Manana --- extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extent-tree.c b/extent-tree.c index b0cfe0a..f094266 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1515,7 +1515,7 @@ again: * to make sure. */ if (ret > 0 && metadata) { - if (path->slots) { + if (path->slots[0]) { path->slots[0]--; btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);