osandov / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
Josef Bacik b5e03c
diff --git a/utils.c b/utils.c
Josef Bacik b5e03c
index a5ffb62..f6686c6 100644
Josef Bacik b5e03c
--- a/utils.c
Josef Bacik b5e03c
+++ b/utils.c
Josef Bacik b5e03c
@@ -476,7 +476,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
Josef Bacik b5e03c
 	u64 num_devs;
Josef Bacik b5e03c
 	int ret;
Josef Bacik b5e03c
 
Josef Bacik b5e03c
-	device = kmalloc(sizeof(*device), GFP_NOFS);
Josef Bacik b5e03c
+	device = kzalloc(sizeof(*device), GFP_NOFS);
Josef Bacik b5e03c
 	if (!device)
Josef Bacik b5e03c
 		return -ENOMEM;
Josef Bacik b5e03c
 	buf = kmalloc(sectorsize, GFP_NOFS);
Josef Bacik b5e03c
@@ -502,6 +502,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
Josef Bacik b5e03c
 	device->bytes_used = 0;
Josef Bacik b5e03c
 	device->total_ios = 0;
Josef Bacik b5e03c
 	device->dev_root = root->fs_info->dev_root;
Josef Bacik b5e03c
+	INIT_LIST_HEAD(&device->dev_list);
Josef Bacik b5e03c
 
Josef Bacik b5e03c
 	ret = btrfs_add_device(trans, root, device);
Josef Bacik b5e03c
 	BUG_ON(ret);