[Top][All Lists]

[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

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);
     opts = qdict_new();
     qdict_put(opts, propname, prop);
-    keyval_merge(machine_opts_dict, opts, errp);
+    keyval_merge(machine_opts_dict, opts, &error_fatal);
@@ -3321,7 +3321,8 @@ void qemu_init(int argc, char **argv, char **envp)
             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);
             case QEMU_OPTION_vnc:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]