From mboxrd@z Thu Jan 1 00:00:00 1970 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) Message-ID: <4F5F5BD5.7090705@gmail.com> Date: Tue, 13 Mar 2012 22:38:13 +0800 From: Zhang Shengju MIME-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] block: write checksum back to footer after check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, yongjun_wei@trendmicro.com.cn 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) -- 1.7.1