[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 104/106] qapi: fix input visitor bugs
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 104/106] qapi: fix input visitor bugs |
Date: |
Wed, 18 Jun 2014 19:22:32 +0300 |
Remove dead code. Reset errno to 0 before each strtoull call, as the
man page requires.
Reported-by: Eric Blake <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
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
- [Qemu-devel] [PULL v2 092/106] qapi: fix build on glib < 2.28, (continued)
- [Qemu-devel] [PULL v2 092/106] qapi: fix build on glib < 2.28, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 094/106] qdev: recursively unrealize devices when unrealizing bus, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 096/106] pc: acpi: do not hardcode preprocessor, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 095/106] qmp: clean out whitespace, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 097/106] numa: handle mmaped memory allocation failure correctly, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 099/106] acpi: introduce TYPE_ACPI_DEVICE_IF interface, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 098/106] qmp: add query-memory-devices command, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 100/106] acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 101/106] qmp: add query-acpi-ospm-status command, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 102/106] qmp: add ACPI_DEVICE_OST event handling, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 104/106] qapi: fix input visitor bugs,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 103/106] acpi: rephrase comment, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 019/106] acpi: rename cpu_hotplug_defs.h to pc-hotplug.h, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 016/106] pc: add memory hotplug handler to PC_MACHINE, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 077/106] memory: add error propagation to file-based RAM allocation, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 040/106] migration: export SELF_ANNOUNCE_ROUNDS, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 078/106] vl: redo -object parsing, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 106/106] qapi/string-output-visitor: fix bugs, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 074/106] qom: introduce object_property_get_enum and object_property_get_uint16List, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 006/106] vl.c: extend -m option to support options for memory hotplug, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 020/106] acpi: memory hotplug ACPI hardware implementation, Michael S. Tsirkin, 2014/06/18