From patchwork Wed Jan 15 14:20:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 11334971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 000D61398 for ; Wed, 15 Jan 2020 14:20:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBDDE24671 for ; Wed, 15 Jan 2020 14:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729048AbgAOOUp (ORCPT ); Wed, 15 Jan 2020 09:20:45 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8727 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728925AbgAOOUp (ORCPT ); Wed, 15 Jan 2020 09:20:45 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5B02BC3A919C29B164B6; Wed, 15 Jan 2020 22:20:41 +0800 (CST) Received: from localhost (10.133.213.239) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Wed, 15 Jan 2020 22:20:35 +0800 From: YueHaibing To: , , , CC: , , YueHaibing Subject: [PATCH -next] btrfs: Fix return value while kcalloc fails in btrfs_rmap_block Date: Wed, 15 Jan 2020 22:20:27 +0800 Message-ID: <20200115142027.56960-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.133.213.239] X-CFilter-Loop: Reflected Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In btrfs_rmap_block(), if kcalloc fails, it should return -ENOMEM instead of 0. Fixes: 767f58cdaf20 ("btrfs: Refactor btrfs_rmap_block to improve readability") Signed-off-by: YueHaibing --- fs/btrfs/block-group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 8877af5..1485158 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1655,7 +1655,7 @@ int btrfs_rmap_block(struct btrfs_fs_info *fs_info, u64 chunk_start, *stripe_len = io_stripe_size; out: free_extent_map(em); - return 0; + return ret; } static int exclude_super_stripes(struct btrfs_block_group *cache)