From: Joel Schopp <jschopp@austin.ibm.com>
To: qemu-devel@nongnu.org
Cc: Joel Schopp <jschopp@austin.ibm.com>
Subject: [Qemu-devel] [PATCH 2/3] fix variable type in qemu-io.c
Date: Wed, 21 Jul 2010 15:05:16 -0500 [thread overview]
Message-ID: <1279742717-10804-3-git-send-email-jschopp@austin.ibm.com> (raw)
In-Reply-To: <1279742717-10804-1-git-send-email-jschopp@austin.ibm.com>
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>
---
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
next prev parent reply other threads:[~2010-07-21 20:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 20:05 [Qemu-devel] [PATCH 0/3] Fix broken if statements Joel Schopp
2010-07-21 20:05 ` [Qemu-devel] [PATCH 1/3] remove dead code from hw/loader.c Joel Schopp
2010-07-21 20:05 ` Joel Schopp [this message]
2010-07-21 20:05 ` [Qemu-devel] [PATCH 3/3] remove pointless if from vl.c Joel Schopp
2010-07-22 16:18 ` [Qemu-devel] [PATCH 0/3] Fix broken if statements Stefan Weil
2010-08-01 17:25 ` Andreas Färber
2010-08-01 20:20 ` Stefan Weil
2010-08-02 15:23 ` Joel Schopp
2010-07-30 21:06 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1279742717-10804-3-git-send-email-jschopp@austin.ibm.com \
--to=jschopp@austin.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).