From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Joel Schopp Date: Wed, 21 Jul 2010 15:05:16 -0500 Message-Id: <1279742717-10804-3-git-send-email-jschopp@austin.ibm.com> In-Reply-To: <1279742717-10804-1-git-send-email-jschopp@austin.ibm.com> References: <1279742717-10804-1-git-send-email-jschopp@austin.ibm.com> Subject: [Qemu-devel] [PATCH 2/3] fix variable type in qemu-io.c List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Joel Schopp 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; } -- 1.7.0.4