From c4dc9eb29fef67dc6a1fd0d69b77a11ff388e222 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 25 Mar 2014 11:45:58 +0100 Subject: [PATCH 40/48] dmg: use appropriate types when reading chunks RH-Author: Kevin Wolf Message-id: <1395744364-16049-40-git-send-email-kwolf@redhat.com> Patchwork-id: n/a O-Subject: [EMBARGOED RHEL-6.6/6.5.z qemu-kvm PATCH v2 39/45] dmg: use appropriate types when reading chunks Bugzilla: 1079518 RH-Acked-by: Max Reitz RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Laszlo Ersek Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1079518 Upstream status: Series embargoed Use the right types instead of signed int: size_t new_size; This is a byte count for g_realloc() that is calculated from uint32_t and size_t values. uint32_t chunk_count; Use the same type as s->n_chunks, which is used together with chunk_count. This patch is a cleanup and does not fix bugs. Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/dmg.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/block/dmg.c b/block/dmg.c index fc20885..ab001b3 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -153,7 +153,8 @@ static int dmg_open(BlockDriverState *bs, int flags) } if (type == 0x6d697368 && count >= 244) { - int new_size, chunk_count; + size_t new_size; + uint32_t chunk_count; offset += 4; offset += 200; -- 1.7.1