* [Qemu-devel] [PATCH] crypto/block: Fix build with gcc 9
@ 2019-02-28 15:06 Greg Kurz
2019-02-28 15:28 ` Eric Blake
2019-02-28 18:06 ` Daniel P. Berrangé
0 siblings, 2 replies; 3+ messages in thread
From: Greg Kurz @ 2019-02-28 15:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Greg Kurz, Daniel P. Berrange, Peter Maydell
Build fails with gcc 9:
crypto/block-luks.c:689:18: error: taking address of packed member of ‘struct QCryptoBlockLUKSHeader’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
689 | be32_to_cpus(&luks->header.payload_offset);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
crypto/block-luks.c:690:18: error: taking address of packed member of ‘struct QCryptoBlockLUKSHeader’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
690 | be32_to_cpus(&luks->header.key_bytes);
| ^~~~~~~~~~~~~~~~~~~~~~~
crypto/block-luks.c:691:18: error: taking address of packed member of ‘struct QCryptoBlockLUKSHeader’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
691 | be32_to_cpus(&luks->header.master_key_iterations);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... a bunch of similar errors...
crypto/block-luks.c:1288:22: error: taking address of packed member of ‘struct QCryptoBlockLUKSKeySlot’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
1288 | be32_to_cpus(&luks->header.key_slots[i].stripes);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
All members of the QCryptoBlockLUKSKeySlot and QCryptoBlockLUKSHeader are
naturally aligned and we already check at build time there isn't any
unwanted padding. Drop the QEMU_PACKED attribute.
Signed-off-by: Greg Kurz <groug@kaod.org>
---
crypto/block-luks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index 6bac79c3ab6b..5a69b3ce74d3 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -146,7 +146,7 @@ struct QCryptoBlockLUKSKeySlot {
uint32_t key_offset;
/* number of anti-forensic stripes */
uint32_t stripes;
-} QEMU_PACKED;
+};
QEMU_BUILD_BUG_ON(sizeof(struct QCryptoBlockLUKSKeySlot) != 48);
@@ -191,7 +191,7 @@ struct QCryptoBlockLUKSHeader {
/* key slots */
QCryptoBlockLUKSKeySlot key_slots[QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS];
-} QEMU_PACKED;
+};
QEMU_BUILD_BUG_ON(sizeof(struct QCryptoBlockLUKSHeader) != 592);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] crypto/block: Fix build with gcc 9
2019-02-28 15:06 [Qemu-devel] [PATCH] crypto/block: Fix build with gcc 9 Greg Kurz
@ 2019-02-28 15:28 ` Eric Blake
2019-02-28 18:06 ` Daniel P. Berrangé
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2019-02-28 15:28 UTC (permalink / raw)
To: Greg Kurz, qemu-devel; +Cc: Peter Maydell
On 2/28/19 9:06 AM, Greg Kurz wrote:
> Build fails with gcc 9:
>
> crypto/block-luks.c:689:18: error: taking address of packed member of ‘struct QCryptoBlockLUKSHeader’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 689 | be32_to_cpus(&luks->header.payload_offset);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> All members of the QCryptoBlockLUKSKeySlot and QCryptoBlockLUKSHeader are
> naturally aligned and we already check at build time there isn't any
> unwanted padding. Drop the QEMU_PACKED attribute.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> crypto/block-luks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] crypto/block: Fix build with gcc 9
2019-02-28 15:06 [Qemu-devel] [PATCH] crypto/block: Fix build with gcc 9 Greg Kurz
2019-02-28 15:28 ` Eric Blake
@ 2019-02-28 18:06 ` Daniel P. Berrangé
1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2019-02-28 18:06 UTC (permalink / raw)
To: Greg Kurz; +Cc: qemu-devel, Peter Maydell
On Thu, Feb 28, 2019 at 04:06:06PM +0100, Greg Kurz wrote:
> Build fails with gcc 9:
>
> crypto/block-luks.c:689:18: error: taking address of packed member of ‘struct QCryptoBlockLUKSHeader’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 689 | be32_to_cpus(&luks->header.payload_offset);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> crypto/block-luks.c:690:18: error: taking address of packed member of ‘struct QCryptoBlockLUKSHeader’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 690 | be32_to_cpus(&luks->header.key_bytes);
> | ^~~~~~~~~~~~~~~~~~~~~~~
> crypto/block-luks.c:691:18: error: taking address of packed member of ‘struct QCryptoBlockLUKSHeader’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 691 | be32_to_cpus(&luks->header.master_key_iterations);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ... a bunch of similar errors...
>
> crypto/block-luks.c:1288:22: error: taking address of packed member of ‘struct QCryptoBlockLUKSKeySlot’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
> 1288 | be32_to_cpus(&luks->header.key_slots[i].stripes);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> All members of the QCryptoBlockLUKSKeySlot and QCryptoBlockLUKSHeader are
> naturally aligned and we already check at build time there isn't any
> unwanted padding. Drop the QEMU_PACKED attribute.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> crypto/block-luks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
I'll queue this one.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-28 18:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-28 15:06 [Qemu-devel] [PATCH] crypto/block: Fix build with gcc 9 Greg Kurz
2019-02-28 15:28 ` Eric Blake
2019-02-28 18:06 ` Daniel P. Berrangé
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).