Skip to content

Commit 35a30d7

Browse files
kdavechrismason-xx
authored andcommitted
btrfs: fix uninitialized return value
When allocation fails in btrfs_read_fs_root_no_name, ret is not set although it is returned, holding a garbage value. Signed-off-by: David Sterba <dsterba@suse.cz> Reviewed-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
1 parent 19fd294 commit 35a30d7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎fs/btrfs/disk-io.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,12 +1299,12 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
12991299
return root;
13001300

13011301
root->free_ino_ctl = kzalloc(sizeof(*root->free_ino_ctl), GFP_NOFS);
1302-
if (!root->free_ino_ctl)
1303-
goto fail;
13041302
root->free_ino_pinned = kzalloc(sizeof(*root->free_ino_pinned),
13051303
GFP_NOFS);
1306-
if (!root->free_ino_pinned)
1304+
if (!root->free_ino_pinned || !root->free_ino_ctl) {
1305+
ret = -ENOMEM;
13071306
goto fail;
1307+
}
13081308

13091309
btrfs_init_free_ino_ctl(root);
13101310
mutex_init(&root->fs_commit_mutex);

0 commit comments

Comments
 (0)