[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 06/18] hw/acpi: Fix legacy CPU plug error API violations
From: |
Michael S. Tsirkin |
Subject: |
Re: [PATCH v2 06/18] hw/acpi: Fix legacy CPU plug error API violations |
Date: |
Mon, 9 Dec 2019 11:01:48 -0500 |
On Wed, Dec 04, 2019 at 10:36:13AM +0100, Markus Armbruster wrote:
> 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" <address@hidden>
> Cc: Igor Mammedov <address@hidden>
> Signed-off-by: Markus Armbruster <address@hidden>
> Reviewed-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Feel free to merge through your tree pls.
> ---
> hw/acpi/cpu_hotplug.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
> index 3ac2045a95..9c3bcc84de 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);
> }
> }
>
> --
> 2.21.0
- [PATCH v2 17/18] hw/intc/s390: Simplify error handling in kvm_s390_flic_realize(), (continued)
- [PATCH v2 17/18] hw/intc/s390: Simplify error handling in kvm_s390_flic_realize(), Markus Armbruster, 2019/12/04
- [PATCH v2 01/18] crypto: Fix certificate file error handling crash bug, Markus Armbruster, 2019/12/04
- [PATCH v2 07/18] hw/core: Fix fit_load_fdt() error handling violations, Markus Armbruster, 2019/12/04
- [PATCH v2 03/18] io: Fix Error usage in a comment <example>, Markus Armbruster, 2019/12/04
- [PATCH v2 18/18] tests-blockjob: Use error_free_or_abort(), Markus Armbruster, 2019/12/04
- [PATCH v2 14/18] s390x/cpumodel: Fix query-cpu-model-FOO error API violations, Markus Armbruster, 2019/12/04
- [PATCH v2 06/18] hw/acpi: Fix legacy CPU plug error API violations, Markus Armbruster, 2019/12/04
- Re: [PATCH v2 06/18] hw/acpi: Fix legacy CPU plug error API violations,
Michael S. Tsirkin <=
- [PATCH v2 10/18] memory-device: Fix memory pre-plug error API violations, Markus Armbruster, 2019/12/04
- [PATCH v2 16/18] error: Clean up unusual names of Error * variables, Markus Armbruster, 2019/12/04
- [PATCH v2 15/18] s390x/cpumodel: Fix query-cpu-definitions error API violations, Markus Armbruster, 2019/12/04
- [PATCH v2 12/18] s390x/cpumodel: Fix feature property error API violations, Markus Armbruster, 2019/12/04
- Re: [PATCH v2 00/18] Error handling fixes, David Hildenbrand, 2019/12/04
- Re: [PATCH v2 00/18] Error handling fixes, Markus Armbruster, 2019/12/04
- Re: [PATCH v2 00/18] Error handling fixes, Cornelia Huck, 2019/12/05