From: Kevin Wolf Date: Wed, 13 Mar 2019 14:22:38 +0000 (+0100) Subject: qcow2: Fix data file error condition in qcow2_co_create() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a0cf83639c7adbdee08a5bac840c5aada019b8f3;p=qemu.git qcow2: Fix data file error condition in qcow2_co_create() We were trying to check whether bdrv_open_blockdev_ref() returned success, but accidentally checked the wrong variable. Spotted by Coverity (CID 1399703). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella --- diff --git a/block/qcow2.c b/block/qcow2.c index 0dd77c6367..d507ee0686 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3073,7 +3073,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp) goto out; } data_bs = bdrv_open_blockdev_ref(qcow2_opts->data_file, errp); - if (bs == NULL) { + if (data_bs == NULL) { ret = -EIO; goto out; }