Skip to content

Commit

Permalink
qcow1: Make padding in the header explicit
Browse files Browse the repository at this point in the history
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 ea54fef)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
kevmw authored and mdroth committed Jul 21, 2014
1 parent 3ba1e61 commit d234c8f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/qcow.c
Expand Up @@ -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

Expand Down

0 comments on commit d234c8f

Please sign in to comment.