Skip to content

Commit

Permalink
block: qcow2 - used QEMU_PACKED for on-disk structures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
codyprime authored and kevmw committed Sep 25, 2013
1 parent e54835c commit c4217f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion block/qcow2.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion block/qcow2.h
Expand Up @@ -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;
Expand Down

0 comments on commit c4217f6

Please sign in to comment.