All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vmdk: false positive of compat6 with hwversion not set
@ 2019-02-21 11:08 yuchenlin
  2019-02-25 13:30 ` [Qemu-devel] [Qemu-block] " Max Reitz
  0 siblings, 1 reply; 2+ messages in thread
From: yuchenlin @ 2019-02-21 11:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: fam, qemu-block, yuchenlin

From: yuchenlin <yuchenlin@synology.com>

In vmdk_co_create_opts, when it finds hw_version is undefined, it will
set it to 4, which misleading the compat6 and hwversion in
vmdk_co_do_create. Simply set hw_version to NULL after free, let
the logic in vmdk_co_do_create to decide the value of hw_version.

This bug can be reproduced by:

$ qemu-img convert -O vmdk -o subformat=streamOptimized,compat6
/home/yuchenlin/syno.qcow2 /home/yuchenlin/syno.vmdk

qemu-img: /home/yuchenlin/syno.vmdk: error while converting vmdk:
compat6 cannot be enabled with hwversion set

Signed-off-by: yuchenlin <yuchenlin@synology.com>
---
 block/vmdk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 096e8eb662..e3bbd18803 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -2260,7 +2260,7 @@ static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts
     compat6 = qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false);
     if (strcmp(hw_version, "undefined") == 0) {
         g_free(hw_version);
-        hw_version = g_strdup("4");
+        hw_version = NULL;
     }
     fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT);
     zeroed_grain = qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] vmdk: false positive of compat6 with hwversion not set
  2019-02-21 11:08 [Qemu-devel] [PATCH] vmdk: false positive of compat6 with hwversion not set yuchenlin
@ 2019-02-25 13:30 ` Max Reitz
  0 siblings, 0 replies; 2+ messages in thread
From: Max Reitz @ 2019-02-25 13:30 UTC (permalink / raw)
  To: yuchenlin, qemu-devel; +Cc: fam, qemu-block, Kevin Wolf

[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]

On 21.02.19 12:08, yuchenlin@synology.com wrote:
> From: yuchenlin <yuchenlin@synology.com>
> 
> In vmdk_co_create_opts, when it finds hw_version is undefined, it will
> set it to 4, which misleading the compat6 and hwversion in
> vmdk_co_do_create. Simply set hw_version to NULL after free, let
> the logic in vmdk_co_do_create to decide the value of hw_version.
> 
> This bug can be reproduced by:
> 
> $ qemu-img convert -O vmdk -o subformat=streamOptimized,compat6
> /home/yuchenlin/syno.qcow2 /home/yuchenlin/syno.vmdk
> 
> qemu-img: /home/yuchenlin/syno.vmdk: error while converting vmdk:
> compat6 cannot be enabled with hwversion set
> 
> Signed-off-by: yuchenlin <yuchenlin@synology.com>
> ---
>  block/vmdk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 096e8eb662..e3bbd18803 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -2260,7 +2260,7 @@ static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts
>      compat6 = qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false);
>      if (strcmp(hw_version, "undefined") == 0) {
>          g_free(hw_version);
> -        hw_version = g_strdup("4");
> +        hw_version = NULL;
>      }
>      fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT);
>      zeroed_grain = qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false);

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-25 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 11:08 [Qemu-devel] [PATCH] vmdk: false positive of compat6 with hwversion not set yuchenlin
2019-02-25 13:30 ` [Qemu-devel] [Qemu-block] " Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.