summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorYoshinori Sano <yoshinori.sano@gmail.com>2011-02-15 12:01:42 (GMT)
committerroot <Chris Mason chris.mason@oracle.com>2011-03-28 09:37:49 (GMT)
commitdac97e516c617f9c797f64b0224050b70aea30c7 (patch)
treec5c7e7a40e649ee9beb9014b284d3a6e66fb94f2 /fs/btrfs/inode.c
parentc622ae6085d0c6ad834213bbf1477eb311359078 (diff)
downloadlinux-dac97e516c617f9c797f64b0224050b70aea30c7.tar.xz
Btrfs: fix uncheck memory allocations
To make Btrfs code more robust, several return value checks where memory allocation can fail are introduced. I use BUG_ON where I don't know how to handle the error properly, which increases the number of using the notorious BUG_ON, though. Signed-off-by: Yoshinori Sano <yoshinori.sano@gmail.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 67fd6e9..f739b25 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -290,6 +290,7 @@ static noinline int add_async_extent(struct async_cow *cow,
struct async_extent *async_extent;
async_extent = kmalloc(sizeof(*async_extent), GFP_NOFS);
+ BUG_ON(!async_extent);
async_extent->start = start;
async_extent->ram_size = ram_size;
async_extent->compressed_size = compressed_size;
@@ -388,6 +389,7 @@ again:
(BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))) {
WARN_ON(pages);
pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
+ BUG_ON(!pages);
if (BTRFS_I(inode)->force_compress)
compress_type = BTRFS_I(inode)->force_compress;