diff options
author | Markus Armbruster <armbru@redhat.com> | 2019-12-04 10:36:13 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2019-12-18 08:36:15 +0100 |
commit | 49e3e11f8f27a75070062965c097e3feacc5d029 (patch) | |
tree | cbca11f291f57589924e87f445ffcb8a06a463a4 /hw | |
parent | 56e477a56399c4e6d7fc0f6227fd9c475f83a8ce (diff) | |
download | qemu-49e3e11f8f27a75070062965c097e3feacc5d029.zip qemu-49e3e11f8f27a75070062965c097e3feacc5d029.tar.gz qemu-49e3e11f8f27a75070062965c097e3feacc5d029.tar.bz2 |
hw/acpi: Fix legacy CPU plug error API violations
legacy_acpi_cpu_plug_cb() dereferences @errp when
acpi_set_cpu_present_bit() fails. That's wrong; see the big comment
in error.h. Introduced in commit cc43364de7 "acpi/cpu-hotplug:
introduce helper function to keep bit setting in one place".
No caller actually passes null, and acpi_set_cpu_present_bit() can't
actually fail.
Fix anyway: drop acpi_set_cpu_present_bit()'s @errp parameter.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20191204093625.14836-7-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/acpi/cpu_hotplug.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c index 3ac2045..9c3bcc8 100644 --- a/hw/acpi/cpu_hotplug.c +++ b/hw/acpi/cpu_hotplug.c @@ -55,8 +55,7 @@ static const MemoryRegionOps AcpiCpuHotplug_ops = { }, }; -static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu, - Error **errp) +static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu) { CPUClass *k = CPU_GET_CLASS(cpu); int64_t cpu_id; @@ -74,10 +73,7 @@ static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu, void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, AcpiCpuHotplug *g, DeviceState *dev, Error **errp) { - acpi_set_cpu_present_bit(g, CPU(dev), errp); - if (*errp != NULL) { - return; - } + acpi_set_cpu_present_bit(g, CPU(dev)); acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS); } @@ -92,7 +88,7 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, gpe_cpu->device = owner; CPU_FOREACH(cpu) { - acpi_set_cpu_present_bit(gpe_cpu, cpu, &error_abort); + acpi_set_cpu_present_bit(gpe_cpu, cpu); } } |