From: Li Zefan Date: Tue, 9 Nov 2010 00:27:27 +0000 (+0800) Subject: btrfs: Fix error handling in zlib X-Git-Tag: upstream/snapshot3+hdmi~11282^2~56^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b72029dc3fd6ba7dc45ccd1cf0aa0ebfa209bd3;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git btrfs: Fix error handling in zlib Return failure if alloc_page() fails to allocate memory, and the upper code will just give up compression. Signed-off-by: Li Zefan --- diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index e5b8b22..b015586 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 = -1; + 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 = -1; + goto out; + } cpage_out = kmap(out_page); pages[nr_pages] = out_page; nr_pages++;