From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vmdk: byteswap VMDK4Header.desc_offset field
Date: Mon, 10 Jun 2013 16:32:23 +0200 [thread overview]
Message-ID: <20130610143223.GA4838@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20130610140454.GI3636@dhcp-200-207.str.redhat.com>
On Mon, Jun 10, 2013 at 04:04:55PM +0200, Kevin Wolf wrote:
> Am 10.06.2013 um 11:07 hat Stefan Hajnoczi geschrieben:
> > Remember to byteswap VMDK4Header.desc_offset on big-endian machines.
> >
> > Cc: qemu-stable@nongnu.org
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>
> Thanks, applied to the block layer.
>
> > @@ -507,8 +507,11 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
> > if (ret < 0) {
> > return ret;
> > }
> > - if (header.capacity == 0 && header.desc_offset) {
> > - return vmdk_open_desc_file(bs, flags, header.desc_offset << 9);
> > + if (header.capacity == 0) {
> > + int64_t desc_offset = le64_to_cpu(header.desc_offset);
> > + if (desc_offset) {
> > + return vmdk_open_desc_file(bs, flags, desc_offset << 9);
> > + }
> > }
>
> Splitting up the if condition wouldn't have been necessary, strictly
> speaking. But I don't mind too much here.
True. The reason I did it is because accessing header.desc_offset
directly is a bad habit. Someone modifying the code might conclude it's
safe to access directly when it actually only works for the limited
cases of zero and non-zero.
Stefan
next prev parent reply other threads:[~2013-06-10 14:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-10 9:07 [Qemu-devel] [PATCH] vmdk: byteswap VMDK4Header.desc_offset field Stefan Hajnoczi
2013-06-10 14:04 ` Kevin Wolf
2013-06-10 14:32 ` Stefan Hajnoczi [this message]
2013-06-10 14:36 ` Kevin Wolf
2013-06-13 2:06 ` Fam Zheng
2013-06-13 8:33 ` Stefan Hajnoczi
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=20130610143223.GA4838@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@redhat.com \
/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).