[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/8] vl.c: Use parse_uint_full() for NUMA nodeid
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 6/8] vl.c: Use parse_uint_full() for NUMA nodeid |
Date: |
Wed, 16 Jan 2013 13:24:09 -0200 |
This should catch many kinds of errors that the current code wasn't
checking for:
- Values that can't be parsed as a number
- Negative values
- Overflow
- Empty string
Signed-off-by: Eduardo Habkost <address@hidden>
---
Cc: Eric Blake <address@hidden>
---
vl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index 3637a39..43ce607 100644
--- a/vl.c
+++ b/vl.c
@@ -1264,11 +1264,14 @@ static void numa_add(const char *optarg)
if (get_param_value(option, 128, "nodeid", optarg) == 0) {
nodenr = nb_numa_nodes;
} else {
- nodenr = strtoull(option, NULL, 10);
+ if (parse_uint_full(option, &nodenr) < 0) {
+ fprintf(stderr, "qemu: Invalid NUMA nodeid: %s\n", option);
+ exit(1);
+ }
}
if (nodenr >= MAX_NODES) {
- fprintf(stderr, "qemu: invalid NUMA nodeid: %d\n", nodenr);
+ fprintf(stderr, "qemu: invalid NUMA nodeid: %llu\n", nodenr);
exit(1);
}
--
1.7.11.7
[Qemu-devel] [PATCH 2/8] vl.c: Fix off-by-one bug when handling "-numa node" argument, Eduardo Habkost, 2013/01/16
[Qemu-devel] [PATCH 7/8] vl.c: Extract -numa "cpus" parsing to separate function, Eduardo Habkost, 2013/01/16
[Qemu-devel] [PATCH 3/8] vl.c: Abort on unknown -numa option type, Eduardo Habkost, 2013/01/16
[Qemu-devel] [PATCH 8/8] vl.c: validate -numa "cpus" parameter properly, Eduardo Habkost, 2013/01/16