Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

David Sterba and committed by
Chris Mason
35a30d7c 19fd2949

+3 -3
+3 -3
fs/btrfs/disk-io.c
··· 1299 1299 return root; 1300 1300 1301 1301 root->free_ino_ctl = kzalloc(sizeof(*root->free_ino_ctl), GFP_NOFS); 1302 - if (!root->free_ino_ctl) 1303 - goto fail; 1304 1302 root->free_ino_pinned = kzalloc(sizeof(*root->free_ino_pinned), 1305 1303 GFP_NOFS); 1306 - if (!root->free_ino_pinned) 1304 + if (!root->free_ino_pinned || !root->free_ino_ctl) { 1305 + ret = -ENOMEM; 1307 1306 goto fail; 1307 + } 1308 1308 1309 1309 btrfs_init_free_ino_ctl(root); 1310 1310 mutex_init(&root->fs_commit_mutex);