render / rpms / qemu

Forked from rpms/qemu 7 months ago
Clone

Blame 0101-qcow1-Make-padding-in-the-header-explicit.patch

12cd54
From 709786ed4fa98cd281beaac3c6770292bd045a30 Mon Sep 17 00:00:00 2001
12cd54
From: Kevin Wolf <kwolf@redhat.com>
12cd54
Date: Wed, 7 May 2014 16:56:10 +0200
12cd54
Subject: [PATCH] qcow1: Make padding in the header explicit
12cd54
12cd54
We were relying on all compilers inserting the same padding in the
12cd54
header struct that is used for the on-disk format. Let's not do that.
12cd54
Mark the struct as packed and insert an explicit padding field for
12cd54
compatibility.
12cd54
12cd54
Cc: qemu-stable@nongnu.org
12cd54
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12cd54
Reviewed-by: Benoit Canet <benoit@irqsave.net>
12cd54
(cherry picked from commit ea54feff58efedc809641474b25a3130309678e7)
12cd54
---
12cd54
 block/qcow.c | 3 ++-
12cd54
 1 file changed, 2 insertions(+), 1 deletion(-)
12cd54
12cd54
diff --git a/block/qcow.c b/block/qcow.c
12cd54
index d5a7d5f..9018f44 100644
12cd54
--- a/block/qcow.c
12cd54
+++ b/block/qcow.c
12cd54
@@ -48,9 +48,10 @@ typedef struct QCowHeader {
12cd54
     uint64_t size; /* in bytes */
12cd54
     uint8_t cluster_bits;
12cd54
     uint8_t l2_bits;
12cd54
+    uint16_t padding;
12cd54
     uint32_t crypt_method;
12cd54
     uint64_t l1_table_offset;
12cd54
-} QCowHeader;
12cd54
+} QEMU_PACKED QCowHeader;
12cd54
 
12cd54
 #define L2_CACHE_SIZE 16
12cd54