From patchwork Tue Mar 13 14:38:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shengju X-Patchwork-Id: 146416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 32174B6EEE for ; Wed, 14 Mar 2012 01:38:53 +1100 (EST) Received: from localhost ([::1]:44576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7SsF-00058E-0U for incoming@patchwork.ozlabs.org; Tue, 13 Mar 2012 10:38:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7Ss1-0004iE-G2 for qemu-devel@nongnu.org; Tue, 13 Mar 2012 10:38:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7Srp-0001jc-Sy for qemu-devel@nongnu.org; Tue, 13 Mar 2012 10:38:37 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:62801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7Srp-0001iX-Mc for qemu-devel@nongnu.org; Tue, 13 Mar 2012 10:38:25 -0400 Received: by ggnj2 with SMTP id j2so697473ggn.4 for ; Tue, 13 Mar 2012 07:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=SwdNHqjJg1qGfUOvVAkgRyLus03lASm6xKn0nfD8D3M=; b=fnbSyuoYQV046y5mbRsV32BGW6J2/B6EQmrDBNUjkSx2YgY2/CDd/VncpecWZ0mOX1 mfmK7Pq0zP/Yw+ypjrurNFFRP3GvzJ/1nx+BEbOTB0hRZc1o0T9uRT4NP/3+dJnLbcIB ZuOm7ZR5XZfd7NH2bbmyyYFfrpgBrvmcJD+pOpkszVX21BjB1D+564syYjbtjpS6o9cG 9DlLV9SYh5uCMjZGeD7HDZ22QowQYCdIBVQzRvjR7Ubl//qUYGlHWhqioz6vsOPE5Xnm vo4iJsy9a7CRB7S5zmmI78LttV9J5mKNzQQtD8Cw2CvkYHaofldjwJheezCLpIVjTNZp dC1A== Received: by 10.68.136.99 with SMTP id pz3mr6332995pbb.114.1331649503027; Tue, 13 Mar 2012 07:38:23 -0700 (PDT) Received: from [10.0.0.106] ([180.110.160.79]) by mx.google.com with ESMTPS id r6sm802047pbq.56.2012.03.13.07.38.16 (version=SSLv3 cipher=OTHER); Tue, 13 Mar 2012 07:38:22 -0700 (PDT) Message-ID: <4F5F5BD5.7090705@gmail.com> Date: Tue, 13 Mar 2012 22:38:13 +0800 From: Zhang Shengju User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.161.173 Cc: kwolf@redhat.com, yongjun_wei@trendmicro.com.cn Subject: [Qemu-devel] [PATCH] block: write checksum back to footer after check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org After validation check, the 'checksum' is not written back to footer, which leave it with zero. This results in errors while loadding it under Microsoft's Hyper-V environment, and also errors from utilities like Citrix's vhd-util. Signed-off-by: Zhang Shengju --- block/vpc.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 6b4816f..12aecd4 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -189,6 +189,9 @@ static int vpc_open(BlockDriverState *bs, int flags) fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", bs->filename); + /* Write 'checksum' back to footer, or else will leave it with zero. */ + footer->checksum = be32_to_cpu(checksum); + // The visible size of a image in Virtual PC depends on the geometry // rather than on the size stored in the footer (the size in the footer // is too large usually)