From patchwork Wed Jul 21 20:05:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jschopp@austin.ibm.com X-Patchwork-Id: 59499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 70BE51007D2 for ; Thu, 22 Jul 2010 06:48:22 +1000 (EST) Received: from localhost ([127.0.0.1]:41988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObfcW-0006Mw-U9 for incoming@patchwork.ozlabs.org; Wed, 21 Jul 2010 16:10:25 -0400 Received: from [140.186.70.92] (port=36353 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObfZM-0005Qx-Bl for qemu-devel@nongnu.org; Wed, 21 Jul 2010 16:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ObfZJ-0003qR-1W for qemu-devel@nongnu.org; Wed, 21 Jul 2010 16:07:05 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:34072) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObfZI-0003bo-VY for qemu-devel@nongnu.org; Wed, 21 Jul 2010 16:07:05 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e3.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o6LJp4mi020400 for ; Wed, 21 Jul 2010 15:51:04 -0400 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o6LK5Xqh340448 for ; Wed, 21 Jul 2010 16:05:33 -0400 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o6LK5MPd004235 for ; Wed, 21 Jul 2010 14:05:23 -0600 Received: from localhost.localdomain (sig-9-65-27-113.mts.ibm.com [9.65.27.113]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o6LK5Lx9004135; Wed, 21 Jul 2010 14:05:22 -0600 From: Joel Schopp To: qemu-devel@nongnu.org Date: Wed, 21 Jul 2010 15:05:16 -0500 Message-Id: <1279742717-10804-3-git-send-email-jschopp@austin.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1279742717-10804-1-git-send-email-jschopp@austin.ibm.com> References: <1279742717-10804-1-git-send-email-jschopp@austin.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Joel Schopp Subject: [Qemu-devel] [PATCH 2/3] fix variable type in qemu-io.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The variable len can get a negative return value from cvtnum, which we check for, but which is impossible with the current unsigned variable type. Currently the if(len < 0) check is pointless. This patch fixes that. Signed-off-by: Joel Schopp --- qemu-io.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index 9adda4c..1a9c13d 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -135,7 +135,7 @@ create_iovec(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern) for (i = 0; i < nr_iov; i++) { char *arg = argv[i]; - uint64_t len; + int64_t len; len = cvtnum(arg); if (len < 0) { @@ -144,7 +144,7 @@ create_iovec(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern) } /* should be SIZE_T_MAX, but that doesn't exist */ - if (len > UINT_MAX) { + if (len > INT_MAX) { printf("too large length argument -- %s\n", arg); goto fail; }