summary refs log tree commit diff stats
path: root/hw
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2021-08-12 18:53:53 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-08-13 14:43:42 +0200
commitea0aa1752ca88f7856cbf40eef0db62f90f28dcd (patch)
treef9519be39f6566f737e1039a66108cd4c4d12365 /hw
parent0b46318170bf2782564e1c444e01a47cda308c7f (diff)
downloadfocaccia-qemu-ea0aa1752ca88f7856cbf40eef0db62f90f28dcd.tar.gz
focaccia-qemu-ea0aa1752ca88f7856cbf40eef0db62f90f28dcd.zip
hw/core: fix error checking in smp_parse
machine_set_smp() mistakenly checks 'errp' not '*errp',
and so thinks there is an error every single time it runs.
This causes it to jump to the end of the method, skipping
the max CPUs checks. The caller meanwhile sees no error
and so carries on execution. The result of all this is:

 $ qemu-system-x86_64 -smp -1
 qemu-system-x86_64: GLib: ../glib/gmem.c:142: failed to allocate 481036337048 bytes

instead of

 $ qemu-system-x86_64 -smp -1
 qemu-system-x86_64: Invalid SMP CPUs -1. The max CPUs supported by machine 'pc-i440fx-6.1' is 255

This is a regression from

  commit fe68090e8fbd6e831aaf3fc3bb0459c5cccf14cf
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   Thu May 13 09:03:48 2021 -0400

    machine: add smp compound property

Closes: https://gitlab.com/qemu-project/qemu/-/issues/524
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210812175353.4128471-1-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/machine.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index abaeda589b..54e040587d 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -833,7 +833,7 @@ static void machine_set_smp(Object *obj, Visitor *v, const char *name,
     }
 
     mc->smp_parse(ms, config, errp);
-    if (errp) {
+    if (*errp) {
         goto out_free;
     }