diff mbox

[v2,2/6] btrfs: Fix error handling in zlib

Message ID 4CE48AF9.6070000@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li Zefan Nov. 18, 2010, 2:10 a.m. UTC
None
diff mbox

Patch

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++;