From: John Snow <jsnow@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 0/3] block/qcow*: Don't take address of fields in packed structs
Date: Tue, 9 Oct 2018 15:04:59 -0400 [thread overview]
Message-ID: <dfa4ca15-2d7d-1c35-d674-352cbb9ed9ba@redhat.com> (raw)
In-Reply-To: <20181009172501.17353-1-peter.maydell@linaro.org>
On 10/09/2018 01:24 PM, Peter Maydell wrote:
> Taking the address of a field in a packed struct is a bad idea, because
> it might not be actually aligned enough for that pointer type (and
> thus cause a crash on dereference on some host architectures). Newer
> versions of clang warn about this. Avoid the bug by not using the
> "modify in place" byte swapping functions.
>
> There are a few places in the affected files where the in-place swap
> function is used on something other than a packed struct field; we
> convert those anyway, for consistency.
>
> Patches produced mechanically using spatch; in one case I also
> did a little hand-editing to wrap overlong lines that checkpatch
> would otherwise complain about.
>
> (clang also complains about other files in block: vdi.c, vpc.c,
> vhdx.h, vhdx.c, vhdx-endian.c, vhdx-log.c -- I may produce patches
> for those later if nobody else gets there first.)
>
> thanks
> -- PMM
>
> Peter Maydell (3):
> block/qcow2: Don't take address of fields in packed structs
> block/qcow: Don't take address of fields in packed structs
> block/qcow2-bitmap: Don't take address of fields in packed structs
>
> block/qcow.c | 18 ++++++-------
> block/qcow2-bitmap.c | 24 ++++++++---------
> block/qcow2.c | 64 +++++++++++++++++++++++---------------------
> 3 files changed, 55 insertions(+), 51 deletions(-)
>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
next prev parent reply other threads:[~2018-10-09 19:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 17:24 [Qemu-devel] [PATCH 0/3] block/qcow*: Don't take address of fields in packed structs Peter Maydell
2018-10-09 17:24 ` [Qemu-devel] [PATCH 1/3] block/qcow2: " Peter Maydell
2018-10-09 17:25 ` [Qemu-devel] [PATCH 2/3] block/qcow: " Peter Maydell
2018-10-09 17:25 ` [Qemu-devel] [PATCH 3/3] block/qcow2-bitmap: " Peter Maydell
2018-10-09 17:49 ` [Qemu-devel] [PATCH 0/3] block/qcow*: " Richard Henderson
2018-10-09 19:04 ` John Snow [this message]
2018-10-10 10:55 ` Kevin Wolf
2018-11-05 14:41 ` Peter Maydell
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=dfa4ca15-2d7d-1c35-d674-352cbb9ed9ba@redhat.com \
--to=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).