From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jes.Sorensen@redhat.com
Subject: [Qemu-devel] [PATCH 2/6] vl: Tighten parsing of -numa's parameter mem
Date: Tue, 22 Nov 2011 09:46:02 +0100 [thread overview]
Message-ID: <1321951566-11667-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1321951566-11667-1-git-send-email-armbru@redhat.com>
strtosz_suffix() fails unless the size is followed by 0, whitespace or
','. Useless here, because we need to fail for any junk following the
size, even if it starts with whitespace or ','. Check manually.
Things like
-smp 4 -numa "node,mem=1024,cpus=0-1" -numa "node,mem=1024 cpus=2-3"
are now caught. Before, the second -numa's argument was silently
interpreted as just "node,mem=1024".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
vl.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index f5afed4..b9146cf 100644
--- a/vl.c
+++ b/vl.c
@@ -953,8 +953,8 @@ static void numa_add(const char *optarg)
node_mem[nodenr] = 0;
} else {
int64_t sval;
- sval = strtosz(option, NULL);
- if (sval < 0) {
+ sval = strtosz(option, &endptr);
+ if (sval < 0 || *endptr) {
fprintf(stderr, "qemu: invalid numa mem size: %s\n", optarg);
exit(1);
}
--
1.7.6.4
next prev parent reply other threads:[~2011-11-22 8:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 8:46 [Qemu-devel] [PATCH 0/6] Fix strtosz users, clean up its implementation Markus Armbruster
2011-11-22 8:46 ` [Qemu-devel] [PATCH 1/6] cutils: Drop broken support for zero strtosz default_suffix Markus Armbruster
2011-11-22 8:46 ` Markus Armbruster [this message]
2011-11-22 8:46 ` [Qemu-devel] [PATCH 3/6] vl: Tighten parsing of -m argument Markus Armbruster
2011-11-22 8:46 ` [Qemu-devel] [PATCH 4/6] x86/cpuid: Tighten parsing of tsc_freq=FREQ Markus Armbruster
2011-11-22 8:46 ` [Qemu-devel] [PATCH 5/6] qemu-img: Tighten parsing of size arguments Markus Armbruster
2011-11-22 8:46 ` [Qemu-devel] [PATCH 6/6] cutils: Make strtosz & friends leave follow set to callers Markus Armbruster
2011-11-28 22:33 ` [Qemu-devel] [PATCH 0/6] Fix strtosz users, clean up its implementation Anthony Liguori
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=1321951566-11667-3-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=Jes.Sorensen@redhat.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).