when i compile this file with some error message ../block.c: In function ‘bdrv_replace_node_common’: ../block.c:4903:9: error: ‘to_cow_parent’ may be used uninitialized in this function [-Werror=maybe-uninitialized] bdrv_remove_filter_or_cow_child(to_cow_parent, tran); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
Signed-off-by: Zhiwei Jiang <elish.ji...@ucloud.cn> --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index 3f456892d0..08f29e6b65 100644 --- a/block.c +++ b/block.c @@ -4866,7 +4866,7 @@ static int bdrv_replace_node_common(BlockDriverState *from, Transaction *tran = tran_new(); g_autoptr(GHashTable) found = NULL; g_autoptr(GSList) refresh_list = NULL; - BlockDriverState *to_cow_parent; + BlockDriverState *to_cow_parent = NULL; int ret; if (detach_subchain) { -- 2.25.1