render / rpms / qemu

Forked from rpms/qemu 5 months ago
Clone

Blame 0236-block-vpc-write-checksum-back-to-footer-after-check.patch

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