From patchwork Thu Feb 21 11:08:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)\" via" X-Patchwork-Id: 10823815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FCEF6C2 for ; Thu, 21 Feb 2019 11:31:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F2DF308AD for ; Thu, 21 Feb 2019 11:31:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D339308C3; Thu, 21 Feb 2019 11:31:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D234308B6 for ; Thu, 21 Feb 2019 11:31:34 +0000 (UTC) Received: from localhost ([127.0.0.1]:58652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwmZh-0006fA-NO for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Feb 2019 06:31:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwmDY-0002zR-BO for qemu-devel@nongnu.org; Thu, 21 Feb 2019 06:08:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwmDS-0007Xj-Mv for qemu-devel@nongnu.org; Thu, 21 Feb 2019 06:08:40 -0500 Received: from mail.synology.com ([211.23.38.101]:44366 helo=synology.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwmDC-0007In-EZ; Thu, 21 Feb 2019 06:08:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synology.com; s=123; t=1550747286; bh=rAtofcVDw7ln4KpkCmUUw4k1vjXRjo/PaPQiokHsnn8=; h=From:To:Cc:Subject:Date; b=j+ciAUsI53VxMMoV017N1Ms7H9YXEzTcnICrlsDRpZ7tXXc1rFf2d7rWfOJOxA6qK YjSubPGeqknxwAwMBBqHW2hn8L7w3/7Uh+gWDqKYz4fp5OmkX3T/PSceUztBru+Ggf G958fbtO88usYrHU+BySsda4nO0KhJUtowthgaM8= To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2019 11:08:05 +0000 Message-Id: <20190221110805.28239-1-yuchenlin@synology.com> X-Synology-MCP-Status: no X-Synology-Spam-Flag: no X-Synology-Spam-Status: score=0, required 6, WHITELIST_FROM_ADDRESS 0 X-Synology-Virus-Status: no X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 211.23.38.101 Subject: [Qemu-devel] [PATCH] vmdk: false positive of compat6 with hwversion not set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: yuchenlin--- via Qemu-devel From: "Zhijian Li (Fujitsu)\" via" Reply-To: yuchenlin@synology.com Cc: fam@euphon.net, yuchenlin , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: yuchenlin 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 --- 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);