thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 2ded69dfa67b8243d579e26839db43a288c251b8 Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Mon, 4 Nov 2013 22:32:25 +0100
9ae3a8
Subject: [PATCH 32/87] qcow2: Correct endianness in overlap check
9ae3a8
9ae3a8
RH-Author: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: <1383604354-12743-35-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 55334
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 34/43] qcow2: Correct endianness in overlap check
9ae3a8
Bugzilla: 1004347
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
BZ: 1004347
9ae3a8
9ae3a8
If an inactive L1 table is loaded from disk, its entries are in big
9ae3a8
endian and have to be converted to host byte order before using them.
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 1e242b5544a48bc43eca9c637dc91ec06bcf3a31)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2-refcount.c | 4 ++--
9ae3a8
 1 file changed, 2 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2-refcount.c |    4 ++--
9ae3a8
 1 files changed, 2 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
9ae3a8
index 2a589b8..34fcf2f 100644
9ae3a8
--- a/block/qcow2-refcount.c
9ae3a8
+++ b/block/qcow2-refcount.c
9ae3a8
@@ -1713,8 +1713,8 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int chk, int64_t offset,
9ae3a8
             }
9ae3a8
 
9ae3a8
             for (j = 0; j < l1_sz; j++) {
9ae3a8
-                if ((l1[j] & L1E_OFFSET_MASK) &&
9ae3a8
-                    overlaps_with(l1[j] & L1E_OFFSET_MASK, s->cluster_size)) {
9ae3a8
+                uint64_t l2_ofs = be64_to_cpu(l1[j]) & L1E_OFFSET_MASK;
9ae3a8
+                if (l2_ofs && overlaps_with(l2_ofs, s->cluster_size)) {
9ae3a8
                     g_free(l1);
9ae3a8
                     return QCOW2_OL_INACTIVE_L2;
9ae3a8
                 }
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8