[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: |
Mon, 4 Feb 2013 16:27:50 -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>
Reviewed-by: Eric Blake <address@hidden>
---
vl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/vl.c b/vl.c
index 4955c29..d6f6422 100644
--- a/vl.c
+++ b/vl.c
@@ -1267,7 +1267,10 @@ 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, 10) < 0) {
+ fprintf(stderr, "qemu: Invalid NUMA nodeid: %s\n", option);
+ exit(1);
+ }
}
if (nodenr >= MAX_NODES) {
--
1.8.1
- [Qemu-devel] [PATCH for-1.4 0/8] -numa option parsing fixes (v7), Eduardo Habkost, 2013/02/04
- [Qemu-devel] [PATCH 5/8] vl.c: numa_add(): Validate nodeid before using it, Eduardo Habkost, 2013/02/04
- [Qemu-devel] [PATCH 6/8] vl.c: Use parse_uint_full() for NUMA nodeid,
Eduardo Habkost <=
- [Qemu-devel] [PATCH 7/8] vl.c: Extract -numa "cpus" parsing to separate function, Eduardo Habkost, 2013/02/04
- [Qemu-devel] [PATCH 2/8] vl.c: Fix off-by-one bug when handling "-numa node" argument, Eduardo Habkost, 2013/02/04
- [Qemu-devel] [PATCH 3/8] vl.c: Abort on unknown -numa option type, Eduardo Habkost, 2013/02/04
- [Qemu-devel] [PATCH 8/8] vl.c: validate -numa "cpus" parameter properly, Eduardo Habkost, 2013/02/04
- [Qemu-devel] [PATCH 4/8] vl.c: Check for NUMA node limit inside numa_add(), Eduardo Habkost, 2013/02/04
- [Qemu-devel] [PATCH 1/8] cutils: unsigned int parsing functions, Eduardo Habkost, 2013/02/04
- Re: [Qemu-devel] [PATCH for-1.4 0/8] -numa option parsing fixes (v7), Anthony Liguori, 2013/02/04