btrfs scrub: handle -ENOMEM from init_ipath()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 16 Nov 2011 08:28:01 +0000 (11:28 +0300)
committerDavid Sterba <dsterba@suse.cz>
Wed, 30 Nov 2011 17:46:01 +0000 (18:46 +0100)
init_ipath() can return an ERR_PTR(-ENOMEM).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
fs/btrfs/scrub.c

index fab420db5121b3c8229a4a2f50cea58e8b6cd022..c27bcb67f3304d806ab7e90cef8c3bcdef78b19c 100644 (file)
@@ -256,6 +256,11 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root, void *ctx)
        btrfs_release_path(swarn->path);
 
        ipath = init_ipath(4096, local_root, swarn->path);
+       if (IS_ERR(ipath)) {
+               ret = PTR_ERR(ipath);
+               ipath = NULL;
+               goto err;
+       }
        ret = paths_from_inode(inum, ipath);
 
        if (ret < 0)