Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35a30d7c authored by David Sterba's avatar David Sterba Committed by Chris Mason
Browse files

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: default avatarDavid Sterba <dsterba@suse.cz>
Reviewed-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 19fd2949
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -1299,12 +1299,12 @@ again:
		return root;
		return root;


	root->free_ino_ctl = kzalloc(sizeof(*root->free_ino_ctl), GFP_NOFS);
	root->free_ino_ctl = kzalloc(sizeof(*root->free_ino_ctl), GFP_NOFS);
	if (!root->free_ino_ctl)
		goto fail;
	root->free_ino_pinned = kzalloc(sizeof(*root->free_ino_pinned),
	root->free_ino_pinned = kzalloc(sizeof(*root->free_ino_pinned),
					GFP_NOFS);
					GFP_NOFS);
	if (!root->free_ino_pinned)
	if (!root->free_ino_pinned || !root->free_ino_ctl) {
		ret = -ENOMEM;
		goto fail;
		goto fail;
	}


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