aboutsummaryrefslogtreecommitdiff
path: root/block/parallels.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2009-11-07 14:10:01 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2009-11-12 11:23:56 -0600
commitc34d2451ed32651e14e309f94009be07d231ee96 (patch)
treee33834dcbe3b1bd1f2fd6990a2da76882ef6173e /block/parallels.c
parent812151f290e35995fb00c33b51048c09faec58a0 (diff)
Fix 32-bit overflow in parallels image support
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/parallels.c')
-rw-r--r--block/parallels.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/parallels.c b/block/parallels.c
index 0b64a5c625..63b67380ad 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -119,7 +119,8 @@ fail:
static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
{
BDRVParallelsState *s = bs->opaque;
- uint32_t index, offset, position;
+ uint32_t index, offset;
+ uint64_t position;
index = sector_num / s->tracks;
offset = sector_num % s->tracks;
@@ -128,7 +129,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
if ((index > s->catalog_size) || (s->catalog_bitmap[index] == 0))
return -1;
- position = (s->catalog_bitmap[index] + offset) * 512;
+ position = (uint64_t)(s->catalog_bitmap[index] + offset) * 512;
// fprintf(stderr, "sector: %llx index=%x offset=%x pointer=%x position=%x\n",
// sector_num, index, offset, s->catalog_bitmap[index], position);