OSDN Git Service

block: qcow2 - used QEMU_PACKED for on-disk structures
authorJeff Cody <jcody@redhat.com>
Wed, 25 Sep 2013 16:08:50 +0000 (12:08 -0400)
committerKevin Wolf <kwolf@redhat.com>
Wed, 25 Sep 2013 18:51:13 +0000 (20:51 +0200)
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 <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2.c
block/qcow2.h

index 318d95d..4a9888c 100644 (file)
@@ -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
index c90e5d6..455e38d 100644 (file)
@@ -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;