From c2eb1176fe06f359a8102bbacb54760c9c1d5aae Mon Sep 17 00:00:00 2001 From: Keqian Zhu Date: Sun, 28 Apr 2024 12:50:09 +0800 Subject: [PATCH] acpi/cpu: Fix detection of present cpu When qemu_present_cpu is false. it means cpu object is null and then calling of qemu_persistent_cpu() will cause null pointer access. Signed-off-by: Keqian Zhu --- hw/acpi/cpu.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index b258396e01..292e1daca2 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -231,11 +231,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, if (qemu_present_cpu(cpu)) { state->devs[i].is_present = true; } else { - if (qemu_persistent_cpu(cpu)) { - state->devs[i].is_present = true; - } else { - state->devs[i].is_present = false; - } + state->devs[i].is_present = false; } if (qemu_enabled_cpu(cpu)) { -- 2.27.0