From: Jeff Cody Date: Wed, 25 Sep 2013 16:08:50 +0000 (-0400) Subject: block: qcow2 - used QEMU_PACKED for on-disk structures X-Git-Tag: v1.7.0-rc0~84^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4217f645dfdfd405cd0c50af953515e1114436a;p=thirdparty%2Fqemu.git 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 --- diff --git a/block/qcow2.c b/block/qcow2.c index 318d95d972e..4a9888cc7f9 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 c90e5d6c6e6..455e38de64f 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;