From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH] qapi: fix input visitor bugs
Date: Wed, 18 Jun 2014 18:36:46 +0300 [thread overview]
Message-ID: <1403105798-25418-1-git-send-email-mst@redhat.com> (raw)
Remove dead code. Reset errno to 0 before each strtoull call, as the
man page requires.
Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
qapi/string-input-visitor.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 72722e6..d8a8db0 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -48,11 +48,10 @@ static void parse_str(StringInputVisitor *siv, Error **errp)
return;
}
- errno = 0;
do {
+ errno = 0;
start = strtoll(str, &endptr, 0);
- if (errno == 0 && endptr > str && INT64_MIN <= start &&
- start <= INT64_MAX) {
+ if (errno == 0 && endptr > str) {
if (*endptr == '\0') {
cur = g_malloc0(sizeof(*cur));
cur->begin = start;
@@ -63,9 +62,9 @@ static void parse_str(StringInputVisitor *siv, Error **errp)
str = NULL;
} else if (*endptr == '-') {
str = endptr + 1;
+ errno = 0;
end = strtoll(str, &endptr, 0);
- if (errno == 0 && endptr > str &&
- INT64_MIN <= end && end <= INT64_MAX && start <= end &&
+ if (errno == 0 && endptr > str && start <= end &&
(start > INT64_MAX - 65536 ||
end < start + 65536)) {
if (*endptr == '\0') {
--
MST
next reply other threads:[~2014-06-18 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 15:36 Michael S. Tsirkin [this message]
2014-06-18 15:41 ` [Qemu-devel] [PATCH] qapi: fix input visitor bugs Eric Blake
2014-06-18 15:44 ` Michael S. Tsirkin
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=1403105798-25418-1-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.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).