958e1b
From 6cce28d5332ad52ae9ec531ae382667bb03cbeb6 Mon Sep 17 00:00:00 2001
eb5a2f
From: Kevin Wolf <kwolf@redhat.com>
eb5a2f
Date: Mon, 2 Jun 2014 13:54:44 +0200
958e1b
Subject: [PATCH 27/31] qcow1: Make padding in the header explicit
eb5a2f
eb5a2f
RH-Author: Kevin Wolf <kwolf@redhat.com>
eb5a2f
Message-id: <1401717288-3918-3-git-send-email-kwolf@redhat.com>
eb5a2f
Patchwork-id: 59097
eb5a2f
O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 2/6] qcow1: Make padding in the header explicit
958e1b
Bugzilla: 1097229 1097230
eb5a2f
RH-Acked-by: Max Reitz <mreitz@redhat.com>
eb5a2f
RH-Acked-by: Fam Zheng <famz@redhat.com>
eb5a2f
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
eb5a2f
958e1b
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097230
958e1b
eb5a2f
We were relying on all compilers inserting the same padding in the
eb5a2f
header struct that is used for the on-disk format. Let's not do that.
eb5a2f
Mark the struct as packed and insert an explicit padding field for
eb5a2f
compatibility.
eb5a2f
eb5a2f
Cc: qemu-stable@nongnu.org
eb5a2f
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
eb5a2f
Reviewed-by: Benoit Canet <benoit@irqsave.net>
eb5a2f
(cherry picked from commit ea54feff58efedc809641474b25a3130309678e7)
eb5a2f
---
eb5a2f
 block/qcow.c | 3 ++-
eb5a2f
 1 file changed, 2 insertions(+), 1 deletion(-)
eb5a2f
eb5a2f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
---
eb5a2f
 block/qcow.c |    3 ++-
eb5a2f
 1 files changed, 2 insertions(+), 1 deletions(-)
eb5a2f
eb5a2f
diff --git a/block/qcow.c b/block/qcow.c
eb5a2f
index b57b900..220ac04 100644
eb5a2f
--- a/block/qcow.c
eb5a2f
+++ b/block/qcow.c
eb5a2f
@@ -48,9 +48,10 @@ typedef struct QCowHeader {
eb5a2f
     uint64_t size; /* in bytes */
eb5a2f
     uint8_t cluster_bits;
eb5a2f
     uint8_t l2_bits;
eb5a2f
+    uint16_t padding;
eb5a2f
     uint32_t crypt_method;
eb5a2f
     uint64_t l1_table_offset;
eb5a2f
-} QCowHeader;
eb5a2f
+} QEMU_PACKED QCowHeader;
eb5a2f
 
eb5a2f
 #define L2_CACHE_SIZE 16
eb5a2f
 
eb5a2f
-- 
eb5a2f
1.7.1
eb5a2f