qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, qemu-block@nongnu.org,
	Fam Zheng <famz@redhat.com>, Igor Mammedov <imammedo@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Ben Warren <ben@skyportsystems.com>,
	Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
	Stefan Weil <sw@weilnetz.de>
Subject: [Qemu-devel] [PATCH 0/3] block: fix last address-of-packed-member warnings
Date: Mon, 10 Dec 2018 11:26:46 +0000	[thread overview]
Message-ID: <20181210112649.11581-1-peter.maydell@linaro.org> (raw)

This patchset fixes the remaining clang warnings in the block/ code
about taking the address of a packed struct member, which are all
in block/vpc and block/vdi code handling UUIDs. Mostly I fix
these by copying the unaligned field to/from a local variable.
In the case of qemu_uuid_bswap() I opted to change the API to
take and return the QemuUUID rather than taking a pointer to it,
which makes almost all the callsites simpler. This does mean
a struct copy but the struct is only 16 bytes and I didn't
judge any of the callsites performance-sensitive enough to care
about a struct copy of that size.

As usual, tested with "make check" only.

thanks
-- PMM


Peter Maydell (3):
  block/vpc: Don't take address of fields in packed structs
  block/vdi: Don't take address of fields in packed structs
  uuid: Make qemu_uuid_bswap() take and return a QemuUUID

 include/qemu/uuid.h  |  2 +-
 block/vdi.c          | 54 +++++++++++++++++++++++++++-----------------
 block/vpc.c          |  4 +++-
 hw/acpi/vmgenid.c    |  6 ++---
 tests/vmgenid-test.c |  2 +-
 util/uuid.c          | 10 ++++----
 6 files changed, 45 insertions(+), 33 deletions(-)

-- 
2.19.2

             reply	other threads:[~2018-12-10 11:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 11:26 Peter Maydell [this message]
2018-12-10 11:26 ` [Qemu-devel] [PATCH 1/3] block/vpc: Don't take address of fields in packed structs Peter Maydell
2018-12-10 11:26 ` [Qemu-devel] [PATCH 2/3] block/vdi: " Peter Maydell
2018-12-10 11:26 ` [Qemu-devel] [PATCH 3/3] uuid: Make qemu_uuid_bswap() take and return a QemuUUID Peter Maydell
2018-12-10 11:37   ` Marc-André Lureau
2018-12-10 17:57   ` Michael S. Tsirkin
2019-01-18 13:59 ` [Qemu-devel] [PATCH 0/3] block: fix last address-of-packed-member warnings Peter Maydell
2019-01-18 16:17 ` Kevin Wolf
2019-02-01 10:30   ` Peter Maydell
2019-02-01 10:57     ` 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=20181210112649.11581-1-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=ben@skyportsystems.com \
    --cc=famz@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=patches@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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).