diff mbox series

[01/15] spapr: Fix error leak in spapr_realize_vcpu()

Message ID 20200914123505.612812-2-groug@kaod.org (mailing list archive)
State New, archived
Headers show
Series spapr: Error handling fixes and cleanups (round 2) | expand

Commit Message

Greg Kurz Sept. 14, 2020, 12:34 p.m. UTC
If spapr_irq_cpu_intc_create() fails, local_err isn't propagated and
thus leaked.

Fixes: 992861fb1e4c ("error: Eliminate error_propagate() manually")
Cc: armbru@redhat.com
Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/ppc/spapr_cpu_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Vladimir Sementsov-Ogievskiy Sept. 15, 2020, 9:08 a.m. UTC | #1
14.09.2020 15:34, Greg Kurz wrote:
> If spapr_irq_cpu_intc_create() fails, local_err isn't propagated and
> thus leaked.
> 
> Fixes: 992861fb1e4c ("error: Eliminate error_propagate() manually")
> Cc: armbru@redhat.com
> Signed-off-by: Greg Kurz <groug@kaod.org>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   hw/ppc/spapr_cpu_core.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index 2125fdac348f..3e4f402b2e9f 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -232,7 +232,6 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
>   {
>       CPUPPCState *env = &cpu->env;
>       CPUState *cs = CPU(cpu);
> -    Error *local_err = NULL;
>   
>       if (!qdev_realize(DEVICE(cpu), NULL, errp)) {
>           return;
> @@ -244,7 +243,7 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
>       cpu_ppc_set_vhyp(cpu, PPC_VIRTUAL_HYPERVISOR(spapr));
>       kvmppc_set_papr(cpu);
>   
> -    if (spapr_irq_cpu_intc_create(spapr, cpu, &local_err) < 0) {
> +    if (spapr_irq_cpu_intc_create(spapr, cpu, errp) < 0) {
>           cpu_remove_sync(CPU(cpu));
>           return;
>       }
>
Philippe Mathieu-Daudé Sept. 15, 2020, 1 p.m. UTC | #2
On 9/14/20 2:34 PM, Greg Kurz wrote:
> If spapr_irq_cpu_intc_create() fails, local_err isn't propagated and
> thus leaked.
> 
> Fixes: 992861fb1e4c ("error: Eliminate error_propagate() manually")
> Cc: armbru@redhat.com
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  hw/ppc/spapr_cpu_core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 2125fdac348f..3e4f402b2e9f 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -232,7 +232,6 @@  static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
 {
     CPUPPCState *env = &cpu->env;
     CPUState *cs = CPU(cpu);
-    Error *local_err = NULL;
 
     if (!qdev_realize(DEVICE(cpu), NULL, errp)) {
         return;
@@ -244,7 +243,7 @@  static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
     cpu_ppc_set_vhyp(cpu, PPC_VIRTUAL_HYPERVISOR(spapr));
     kvmppc_set_papr(cpu);
 
-    if (spapr_irq_cpu_intc_create(spapr, cpu, &local_err) < 0) {
+    if (spapr_irq_cpu_intc_create(spapr, cpu, errp) < 0) {
         cpu_remove_sync(CPU(cpu));
         return;
     }