btrfs-progs: check: improved error handling in calc_extent_flag
authorDavid Sterba <dsterba@suse.com>
Tue, 6 Sep 2016 11:08:29 +0000 (13:08 +0200)
committerDavid Sterba <dsterba@suse.com>
Wed, 21 Sep 2016 12:12:38 +0000 (14:12 +0200)
All callers handle errors.

Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c

index df97d3b..aff3c03 100644 (file)
@@ -6047,7 +6047,9 @@ static int calc_extent_flag(struct btrfs_root *root,
 
        cache = lookup_cache_extent(extent_cache, buf->start, 1);
        /* we have added this extent before */
-       BUG_ON(!cache);
+       if (!cache)
+               return -ENOENT;
+
        rec = container_of(cache, struct extent_record, cache);
 
        /*