From patchwork Mon Oct 19 11:38:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 7435251 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DB9879F302 for ; Mon, 19 Oct 2015 11:50:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12FF7206E0 for ; Mon, 19 Oct 2015 11:50:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E046206DF for ; Mon, 19 Oct 2015 11:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111AbbJSLuQ (ORCPT ); Mon, 19 Oct 2015 07:50:16 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36617 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750885AbbJSLuP (ORCPT ); Mon, 19 Oct 2015 07:50:15 -0400 Received: by pacfv9 with SMTP id fv9so93780012pac.3 for ; Mon, 19 Oct 2015 04:50:14 -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:in-reply-to:references; bh=78LX00zEg3+0e2cLVJ/+NYmqJYegqHBmU6DLCEh4jDk=; b=KZjRsiM+mdzuJNh8LxKHtEDCDdwGKYAIhLlovJqxr0Z+oE8GZLwKY+T727D1cWxoWA zBEkqHdwdzLGZiH1FDKhfO9nAjUwrhdWaIDL2ki0MTnIOOlHx5pVpKbHMTIKeHNoLgsd +SF9jCJYO/E/2C6/Pv3lXzrGKfnK0+8uf33r8nJXS+Mmh/qgJW6iECItKTtGnmG91iNo FNZg7hBMUscUgM9WNigQtQo9XSxR0DA6z4a5Al4pSgf70cjRYv1sQr/7lBljl06LcSVI Wfby9vvx2HlplzU1Fd0qNXVADc0mX37DA8+Qh0mDM4hco50G++ofYb1hHHY9DZve8CvN 3c9Q== X-Received: by 10.66.121.163 with SMTP id ll3mr34488381pab.69.1445255414629; Mon, 19 Oct 2015 04:50:14 -0700 (PDT) Received: from localhost ([128.199.137.77]) by smtp.gmail.com with ESMTPSA id xg2sm35982072pbb.2.2015.10.19.04.50.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 04:50:13 -0700 (PDT) From: Eryu Guan To: linux-btrfs@vger.kernel.org Cc: Eryu Guan Subject: [PATCH 10/10] btrfs-progs: return -ENOMEM properly in btrfs_read_block_groups() Date: Mon, 19 Oct 2015 19:38:00 +0800 Message-Id: <1445254680-11102-11-git-send-email-guaneryu@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> References: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> 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 Breaking from the while loop makes ret overwritten to zero, goto error label directly and return -ENOMEM. Signed-off-by: Eryu Guan --- extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extent-tree.c b/extent-tree.c index 0c8152a..97cf961 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -3255,7 +3255,7 @@ int btrfs_read_block_groups(struct btrfs_root *root) cache = kzalloc(sizeof(*cache), GFP_NOFS); if (!cache) { ret = -ENOMEM; - break; + goto error; } read_extent_buffer(leaf, &cache->item,