[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/16] vl: Clean up -smp error handling
|
From: |
Markus Armbruster |
|
Subject: |
[PATCH 15/16] vl: Clean up -smp error handling |
|
Date: |
Tue, 20 Jul 2021 14:54:07 +0200 |
The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL. Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.
machine_parse_property_opt() is wrong that way: it passes @errp to
keyval_parse() without checking for failure, then passes it to
keyval_merge(). Harmless, since the only caller passes &error_fatal.
Clean up: drop the parameter, and use &error_fatal directly.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
softmmu/vl.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index f9ffeb8d4d..ce0ecc736b 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1535,19 +1535,19 @@ static void machine_help_func(const QDict *qdict)
static void
machine_parse_property_opt(QemuOptsList *opts_list, const char *propname,
- const char *arg, Error **errp)
+ const char *arg)
{
QDict *opts, *prop;
bool help = false;
- prop = keyval_parse(arg, opts_list->implied_opt_name, &help, errp);
+ prop = keyval_parse(arg, opts_list->implied_opt_name, &help, &error_fatal);
if (help) {
qemu_opts_print_help(opts_list, true);
return;
}
opts = qdict_new();
qdict_put(opts, propname, prop);
- keyval_merge(machine_opts_dict, opts, errp);
+ keyval_merge(machine_opts_dict, opts, &error_fatal);
qobject_unref(opts);
}
@@ -3321,7 +3321,8 @@ void qemu_init(int argc, char **argv, char **envp)
}
break;
case QEMU_OPTION_smp:
- machine_parse_property_opt(qemu_find_opts("smp-opts"), "smp",
optarg, &error_fatal);
+ machine_parse_property_opt(qemu_find_opts("smp-opts"),
+ "smp", optarg);
break;
case QEMU_OPTION_vnc:
vnc_parse(optarg);
--
2.31.1
- [PATCH 07/16] vfio: Avoid error_propagate() after migrate_add_blocker(), (continued)
- [PATCH 07/16] vfio: Avoid error_propagate() after migrate_add_blocker(), Markus Armbruster, 2021/07/20
- [PATCH 05/16] vhost-scsi: Plug memory leak on migrate_add_blocker() failure, Markus Armbruster, 2021/07/20
- [PATCH 11/16] microvm: Drop dead error handling in microvm_machine_state_init(), Markus Armbruster, 2021/07/20
- [PATCH 04/16] multi-process: Fix pci_proxy_dev_realize() error handling, Markus Armbruster, 2021/07/20
- [PATCH 15/16] vl: Clean up -smp error handling,
Markus Armbruster <=
- [PATCH 14/16] Remove superfluous ERRP_GUARD(), Markus Armbruster, 2021/07/20
- [PATCH 16/16] vl: Don't continue after -smp help., Markus Armbruster, 2021/07/20
- [PATCH 12/16] vhost: Clean up how VhostOpts method vhost_get_config() fails, Markus Armbruster, 2021/07/20
- [PATCH 13/16] vhost: Clean up how VhostOpts method vhost_backend_init() fails, Markus Armbruster, 2021/07/20
- [PATCH 01/16] error: Use error_fatal to simplify obvious fatal errors (again), Markus Armbruster, 2021/07/20