[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/5] vl: remove dead code in parse_memory_options()
From: |
Paolo Bonzini |
Subject: |
[PULL 4/5] vl: remove dead code in parse_memory_options() |
Date: |
Mon, 8 Aug 2022 14:57:05 +0200 |
mem_str will never be an empty string, because qemu_opt_get_size() fails
if it encounters one:
$ ./qemu-system-x86_64 -m size=
qemu-system-x86_64: -m size=: Parameter size expects a non-negative number
below 2^64
Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
and exabytes, respectively.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 45e919de9f..706bd7cff7 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1960,13 +1960,8 @@ static void parse_memory_options(void)
prop = qdict_new();
if (qemu_opt_get_size(opts, "size", 0) != 0) {
- mem_str = qemu_opt_get(opts, "size");
- if (!*mem_str) {
- error_report("missing 'size' option value");
- exit(EXIT_FAILURE);
- }
-
/* Fix up legacy suffix-less format */
+ mem_str = qemu_opt_get(opts, "size");
if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) {
g_autofree char *mib_str = g_strdup_printf("%sM", mem_str);
qdict_put_str(prop, "size", mib_str);
--
2.37.1
- [PULL 0/5] Misc QEMU 7.1 fixes for 2002-08-08, Paolo Bonzini, 2022/08/08
- [PULL 1/5] scsi-disk: fix overflow when block size is not a multiple of BDRV_SECTOR_SIZE, Paolo Bonzini, 2022/08/08
- [PULL 2/5] scsi-disk: ensure block size is non-zero and changes limited to bits 8-15, Paolo Bonzini, 2022/08/08
- [PULL 3/5] vl: fix [memory] section with -readconfig, Paolo Bonzini, 2022/08/08
- [PULL 5/5] tests/qtest: add scenario for -readconfig handling, Paolo Bonzini, 2022/08/08
- [PULL 4/5] vl: remove dead code in parse_memory_options(),
Paolo Bonzini <=
- Re: [PULL 0/5] Misc QEMU 7.1 fixes for 2002-08-08, Thomas Huth, 2022/08/08
- Re: [PULL 0/5] Misc QEMU 7.1 fixes for 2002-08-08, Richard Henderson, 2022/08/08