]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
qcow1: Make padding in the header explicit
authorKevin Wolf <kwolf@redhat.com>
Wed, 7 May 2014 14:56:10 +0000 (16:56 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 21 Jul 2014 03:29:09 +0000 (22:29 -0500)
We were relying on all compilers inserting the same padding in the
header struct that is used for the on-disk format. Let's not do that.
Mark the struct as packed and insert an explicit padding field for
compatibility.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
(cherry picked from commit ea54feff58efedc809641474b25a3130309678e7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow.c

index d5a7d5fd1eddd11c6fdc6868e9fa77a69aefd80c..9018f44e64b005a29dc9d2b92405602bc9e2ab4f 100644 (file)
@@ -48,9 +48,10 @@ typedef struct QCowHeader {
     uint64_t size; /* in bytes */
     uint8_t cluster_bits;
     uint8_t l2_bits;
+    uint16_t padding;
     uint32_t crypt_method;
     uint64_t l1_table_offset;
-} QCowHeader;
+} QEMU_PACKED QCowHeader;
 
 #define L2_CACHE_SIZE 16