thebeanogamer / rpms / qemu-kvm

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