]> git.proxmox.com Git - qemu.git/commitdiff
fix variable type in qemu-io.c
authorJoel Schopp <jschopp@austin.ibm.com>
Wed, 21 Jul 2010 20:05:16 +0000 (15:05 -0500)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 30 Jul 2010 21:05:51 +0000 (23:05 +0200)
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 <jschopp@austin.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
qemu-io.c

index 7c6120b6acc5c3cd88f8371bc8d3a337922f49aa..2dbe20f33e669b9bcc734d6c1918d666ef7db2ce 100644 (file)
--- 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;
                }