hw/core: fix error checkig in smp_parse
PATCH 1/1 hw/core: fix error checkig in smp_parse
The 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 <[email protected]>
Date: Thu May 13 09:03:48 2021 -0400
machine: add smp compound property
--- hw/core/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -1
@@ -832,7 +832,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; }
Signature · 1 line
2.31.1
Quoted 16 lines · Daniel P. Berrangé
The
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 bytesinstead 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 255This is a regression from
Quoted 8 lines
commit
fe68090e8fbd6e831aaf3fc3bb0459c5cccf14cf
Author: Paolo Bonzini <[email protected]>
Date: Thu May 13 09:03:48 2021 -0400machine: add smp compound property
I will prepare a pull request with this, just in case we are already going to have a -rc4. I don't think this bug alone should delay release of 6.1, though.
Quoted 20 lines
--- hw/core/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/core/machine.c +1
-1@@ -832,7 +832,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; }Signature · 1 line
2.31.1
Signature · 1 line
Eduardo
Paolo Bonzini
AppliedQuoted 34 lines · Daniel P. Berrangé
The
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 bytesinstead 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 255This is a regression from
commit
fe68090e8fbd6e831aaf3fc3bb0459c5cccf14cf
Author: Paolo Bonzini <[email protected]>
Date: Thu May 13 09:03:48 2021 -0400machine: add smp compound property
Signed-off-by Daniel P. Berrangé <[email protected]>--- hw/core/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/core/machine.c +0
-0
hw/core/machine.c static void machine_set_smp(Object *obj, Visitor *v, const char *name, · line 838
Quoted 8 lines
hw/core/machine.c +1
-1@@ -832,7 +832,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; }
Queued, thanks.
Paolo