btrfs-progs: return -ENOMEM properly in btrfs_read_block_groups()
authorEryu Guan <guaneryu@gmail.com>
Mon, 19 Oct 2015 11:38:00 +0000 (19:38 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:03 +0000 (09:35 +0100)
Breaking from the while loop makes ret overwritten to zero, goto error
label directly and return -ENOMEM.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
extent-tree.c

index 0c8152a..97cf961 100644 (file)
@@ -3255,7 +3255,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
                cache = kzalloc(sizeof(*cache), GFP_NOFS);
                if (!cache) {
                        ret = -ENOMEM;
-                       break;
+                       goto error;
                }
 
                read_extent_buffer(leaf, &cache->item,