From c4217f645dfdfd405cd0c50af953515e1114436a Mon Sep 17 00:00:00 2001 From: Jeff Cody Date: Wed, 25 Sep 2013 12:08:50 -0400 Subject: block: qcow2 - used QEMU_PACKED for on-disk structures QCowHeader and QCowExtension are structs that reside in the on-disk image format, and are read and written directly via bdrv_pread()/write(), and as such should be packed to avoid any unintentional struct padding. Signed-off-by: Jeff Cody Reviewed-by: Richard Henderson Signed-off-by: Kevin Wolf --- block/qcow2.c | 2 +- block/qcow2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 318d95d..4a9888c 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -52,7 +52,7 @@ typedef struct { uint32_t magic; uint32_t len; -} QCowExtension; +} QEMU_PACKED QCowExtension; #define QCOW2_EXT_MAGIC_END 0 #define QCOW2_EXT_MAGIC_BACKING_FORMAT 0xE2792ACA diff --git a/block/qcow2.h b/block/qcow2.h index c90e5d6..455e38d 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -86,7 +86,7 @@ typedef struct QCowHeader { uint32_t refcount_order; uint32_t header_length; -} QCowHeader; +} QEMU_PACKED QCowHeader; typedef struct QCowSnapshot { uint64_t l1_table_offset; -- cgit v1.1