summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-01-08 09:42:07 +0800
committerKevin Wolf <kwolf@redhat.com>2014-01-22 12:07:16 +0100
commit585ea0c841df47c1542d33e17c5c6d532316ef74 (patch)
tree5294a965806379ab7d6f8099c078e7362cdde94f /block
parent7fa9e1f941b4be1f71bb42de2f2ed8805d7e7326 (diff)
downloadqemu-585ea0c841df47c1542d33e17c5c6d532316ef74.tar.gz
qemu-585ea0c841df47c1542d33e17c5c6d532316ef74.tar.bz2
qemu-585ea0c841df47c1542d33e17c5c6d532316ef74.zip
vmdk: Fix big flat extent IO
Local variable "n" as int64_t avoids overflow with large sector number calculation. See test case change for failure case. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vmdk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index c6b60b4a91..22b99b04ac 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1325,8 +1325,8 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
{
BDRVVmdkState *s = bs->opaque;
VmdkExtent *extent = NULL;
- int n, ret;
- int64_t index_in_cluster;
+ int ret;
+ int64_t index_in_cluster, n;
uint64_t extent_begin_sector, extent_relative_sector_num;
uint64_t cluster_offset;
VmdkMetaData m_data;