thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From faa093fc3b71b073a73f800785c3cdabe5a91cc3 Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Tue, 25 Mar 2014 14:23:21 +0100
9ae3a8
Subject: [PATCH 14/49] bochs: Fix bitmap offset calculation
9ae3a8
9ae3a8
RH-Author: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Message-id: <1395753835-7591-15-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: n/a
9ae3a8
O-Subject: [virt-devel] [EMBARGOED RHEL-7.0 qemu-kvm PATCH 14/48] bochs: Fix bitmap offset calculation
9ae3a8
Bugzilla: 1066691
9ae3a8
RH-Acked-by: Jeff Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1066691
9ae3a8
Upstream status: Series embargoed
9ae3a8
9ae3a8
32 bit truncation could let us access the wrong offset in the image.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
---
9ae3a8
 block/bochs.c |    5 +++--
9ae3a8
 1 files changed, 3 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/bochs.c b/block/bochs.c
9ae3a8
index 0ec980a..5c74223 100644
9ae3a8
--- a/block/bochs.c
9ae3a8
+++ b/block/bochs.c
9ae3a8
@@ -185,8 +185,9 @@ static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num)
9ae3a8
 	return -1; /* not allocated */
9ae3a8
     }
9ae3a8
 
9ae3a8
-    bitmap_offset = s->data_offset + (512 * s->catalog_bitmap[extent_index] *
9ae3a8
-	(s->extent_blocks + s->bitmap_blocks));
9ae3a8
+    bitmap_offset = s->data_offset +
9ae3a8
+        (512 * (uint64_t) s->catalog_bitmap[extent_index] *
9ae3a8
+        (s->extent_blocks + s->bitmap_blocks));
9ae3a8
 
9ae3a8
     /* read in bitmap for current extent */
9ae3a8
     if (bdrv_pread(bs->file, bitmap_offset + (extent_offset / 8),
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8