From patchwork Tue Jul 8 17:18:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 368853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9981D140092 for ; Fri, 11 Jul 2014 09:19:25 +1000 (EST) Received: from localhost ([::1]:57330 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4ZVs-00089b-RQ for incoming@patchwork.ozlabs.org; Tue, 08 Jul 2014 13:49:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z6k-0004jh-CR for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:24:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4Z6A-0000m7-CY for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:23:10 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:50671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z69-0000iw-N0 for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:22:34 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jul 2014 13:22:33 -0400 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 8 Jul 2014 13:22:30 -0400 Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 84EBA6E8048; Tue, 8 Jul 2014 13:22:20 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp23033.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s68HMTr256492194; Tue, 8 Jul 2014 17:22:29 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s68HMT8D000325; Tue, 8 Jul 2014 13:22:29 -0400 Received: from localhost ([9.41.105.211]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s68HMT74032748; Tue, 8 Jul 2014 13:22:29 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 8 Jul 2014 12:18:16 -0500 Message-Id: <1404839947-1086-106-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14070817-5806-0000-0000-00002556D2A7 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.182.137 Cc: qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 105/156] dmg: use appropriate types when reading chunks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Hajnoczi 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 Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi (cherry picked from commit eb71803b041f55779ea10d860c0f66df285c68de) Signed-off-by: Michael Roth --- block/dmg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/dmg.c b/block/dmg.c index 1cc5426..f98c94d 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -161,7 +161,8 @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags, } if (type == 0x6d697368 && count >= 244) { - int new_size, chunk_count; + size_t new_size; + uint32_t chunk_count; offset += 4; offset += 200;