summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2012-04-12 22:03:56 +0200
committerChris Mason <chris.mason@oracle.com>2012-04-12 22:03:56 +0200
commite627ee7bcd42b4e3a03ca01a8e46dcb4033c5ae0 (patch)
treea6f8060dd57184e79b5c46404c941f999137030d /fs/btrfs/compression.c
parentBtrfs: remove lock assert from get_restripe_target() (diff)
downloadlinux-e627ee7bcd42b4e3a03ca01a8e46dcb4033c5ae0.tar.xz
linux-e627ee7bcd42b4e3a03ca01a8e46dcb4033c5ae0.zip
Btrfs: check return value of bio_alloc() properly
bio_alloc() has the possibility of returning NULL. So, it is necessary to check the return value. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r--fs/btrfs/compression.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index d11afa67c7d8..646f5e6f2566 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -405,6 +405,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
bio_put(bio);
bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS);
+ BUG_ON(!bio);
bio->bi_private = cb;
bio->bi_end_io = end_compressed_bio_write;
bio_add_page(bio, page, PAGE_CACHE_SIZE, 0);
@@ -687,6 +688,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
comp_bio = compressed_bio_alloc(bdev, cur_disk_byte,
GFP_NOFS);
+ BUG_ON(!comp_bio);
comp_bio->bi_private = cb;
comp_bio->bi_end_io = end_compressed_bio_read;