Patchwork [PULL,17/30] block: qed - use QEMU_PACKED for on-disk structures

login
register
mail settings
Submitter Kevin Wolf
Date Sept. 27, 2013, 3:39 p.m.
Message ID <1380296370-14523-18-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/278620/
State New
Headers show

Comments

Kevin Wolf - Sept. 27, 2013, 3:39 p.m.
From: Jeff Cody <jcody@redhat.com>

QEDHeader is read, and written, directly from on-disk images
via bdrv_pread()/write().  To avoid any unintentional padding,
these structs should be packed.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qed.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/block/qed.h b/block/qed.h
index 2b4dded..5d65bea 100644
--- a/block/qed.h
+++ b/block/qed.h
@@ -100,7 +100,7 @@  typedef struct {
     /* if (features & QED_F_BACKING_FILE) */
     uint32_t backing_filename_offset; /* in bytes from start of header */
     uint32_t backing_filename_size;   /* in bytes */
-} QEDHeader;
+} QEMU_PACKED QEDHeader;
 
 typedef struct {
     uint64_t offsets[0];            /* in bytes */