cd9d161
From add89f969fc86f3b3223c4283ee49fcb507b8f81 Mon Sep 17 00:00:00 2001
cd9d161
From: Zhang Shengju <zhangsju@gmail.com>
cd9d161
Date: Tue, 13 Mar 2012 22:38:13 +0800
cd9d161
Subject: [PATCH] block/vpc: write checksum back to footer after check
cd9d161
MIME-Version: 1.0
cd9d161
Content-Type: text/plain; charset=UTF-8
cd9d161
Content-Transfer-Encoding: 8bit
cd9d161
cd9d161
After validation check, the 'checksum' is not written back
cd9d161
to footer, which leave it with zero.
cd9d161
cd9d161
This results in errors while loadding it under Microsoft's
cd9d161
Hyper-V environment, and also errors from utilities like
cd9d161
Citrix's vhd-util.
cd9d161
cd9d161
Signed-off-by: Zhang Shengju <sean_zhang@trendmicro.com.cn>
cd9d161
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
cd9d161
(cherry picked from commit c088b691363070d151f80cc1fde4b7c151bdfe8f)
cd9d161
cd9d161
Signed-off-by: Andreas Färber <afaerber@suse.de>
cd9d161
---
cd9d161
 block/vpc.c | 3 +++
cd9d161
 1 file changed, 3 insertions(+)
cd9d161
cd9d161
diff --git a/block/vpc.c b/block/vpc.c
cd9d161
index ac33e15..55201e2 100644
cd9d161
--- a/block/vpc.c
cd9d161
+++ b/block/vpc.c
cd9d161
@@ -170,6 +170,9 @@ static int vpc_open(BlockDriverState *bs, int flags)
cd9d161
         fprintf(stderr, "block-vpc: The header checksum of '%s' is "
cd9d161
             "incorrect.\n", bs->filename);
cd9d161
 
cd9d161
+    /* Write 'checksum' back to footer, or else will leave it with zero. */
cd9d161
+    footer->checksum = be32_to_cpu(checksum);
cd9d161
+
cd9d161
     // The visible size of a image in Virtual PC depends on the geometry
cd9d161
     // rather than on the size stored in the footer (the size in the footer
cd9d161
     // is too large usually)
cd9d161
-- 
cd9d161
1.7.11.2
cd9d161