From patchwork Thu Nov 18 02:10:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zefan X-Patchwork-Id: 334841 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAI2HuSa014002 for ; Thu, 18 Nov 2010 02:17:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754736Ab0KRCRt (ORCPT ); Wed, 17 Nov 2010 21:17:49 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:65319 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754667Ab0KRCRs (ORCPT ); Wed, 17 Nov 2010 21:17:48 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 41B34170CC5; Thu, 18 Nov 2010 10:17:46 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id oAI2DJlV017898; Thu, 18 Nov 2010 10:13:20 +0800 Received: from lizf.localdomain ([10.167.225.51]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2010111810085182-41914 ; Thu, 18 Nov 2010 10:08:51 +0800 Message-ID: <4CE48AF9.6070000@cn.fujitsu.com> Date: Thu, 18 Nov 2010 10:10:01 +0800 From: Li Zefan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: Chris Mason CC: Mitch Harder , linux-btrfs@vger.kernel.org Subject: [PATCH v2 2/6] btrfs: Fix error handling in zlib References: <4CE48ABB.5070302@cn.fujitsu.com> In-Reply-To: <4CE48ABB.5070302@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-11-18 10:08:51, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-11-18 10:18:09, Serialize complete at 2010-11-18 10:18:09 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 18 Nov 2010 02:17:57 +0000 (UTC) diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index e5b8b22..5a8ba17 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c @@ -225,6 +225,10 @@ int btrfs_zlib_compress_pages(struct address_space *mapping, data_in = kmap(in_page); out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM); + if (out_page == NULL) { + ret = -ENOMEM; + goto out; + } cpage_out = kmap(out_page); pages[0] = out_page; nr_pages = 1; @@ -263,6 +267,10 @@ int btrfs_zlib_compress_pages(struct address_space *mapping, goto out; } out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM); + if (out_page == NULL) { + ret = -ENOMEM; + goto out; + } cpage_out = kmap(out_page); pages[nr_pages] = out_page; nr_pages++;