qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Shengju <zhangsju@gmail.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, yongjun_wei@trendmicro.com.cn
Subject: [Qemu-devel] [PATCH] block: write checksum back to footer after check
Date: Tue, 13 Mar 2012 22:38:13 +0800	[thread overview]
Message-ID: <4F5F5BD5.7090705@gmail.com> (raw)

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 <sean_zhang@trendmicro.com.cn>
---
 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

             reply	other threads:[~2012-03-13 14:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 14:38 Zhang Shengju [this message]
2012-03-13 14:58 ` [Qemu-devel] [PATCH] block: write checksum back to footer after check Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F5F5BD5.7090705@gmail.com \
    --to=zhangsju@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yongjun_wei@trendmicro.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).