summaryrefslogtreecommitdiffstats
path: root/block/vmdk.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-09-23 09:56:21 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2014-10-03 10:30:33 +0100
commitd1319b077a4bd980ca1b8a167b02b519330dd26b (patch)
tree4f1619aa32207583f2942fa058bc49078b1cff73 /block/vmdk.c
parentfbf28a4328123b3259d100eedc0e6f5b7f8bf186 (diff)
downloadhqemu-d1319b077a4bd980ca1b8a167b02b519330dd26b.zip
hqemu-d1319b077a4bd980ca1b8a167b02b519330dd26b.tar.gz
vmdk: Fix integer overflow in offset calculation
This fixes the bug introduced by commit c6ac36e (vmdk: Optimize cluster allocation). $ ~/build/master/qemu-io /stor/vm/arch.vmdk -c 'write 2G 1k' write failed: Invalid argument Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1411437381-11234-1-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r--block/vmdk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index afdea1a..4ae6c75 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1113,7 +1113,7 @@ static int get_cluster_offset(BlockDriverState *bs,
uint32_t min_count, *l2_table;
bool zeroed = false;
int64_t ret;
- int32_t cluster_sector;
+ int64_t cluster_sector;
if (m_data) {
m_data->valid = 0;
OpenPOWER on IntegriCloud