[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 1/9] xilinx: Fix latent error handling bug

From: Markus Armbruster
Subject: [Qemu-devel] [PULL 1/9] xilinx: Fix latent error handling bug
Date: Thu, 13 Jul 2017 15:27:48 +0200

From: Eduardo Habkost <address@hidden>

Assigning directly to *errp is not valid, as errp may be null,
&error_fatal, or &error_abort.  The !*errp conditional protects
against the latter two, but we then leak @local_err.  Fortunately,
the qdev core always passes pointer to null, so this is "merely" a
latent bug.

Use error_propagate() instead.

Cc: "Edgar E. Iglesias" <address@hidden>
Cc: Alistair Francis <address@hidden>
Cc: Jason Wang <address@hidden>
Cc: address@hidden
Signed-off-by: Eduardo Habkost <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
[Commit message clarified]
Signed-off-by: Markus Armbruster <address@hidden>
 hw/dma/xilinx_axidma.c  | 4 +---
 hw/net/xilinx_axienet.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index 6065689..3987b5f 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -554,9 +554,7 @@ static void xilinx_axidma_realize(DeviceState *dev, Error 
-    if (!*errp) {
-        *errp = local_err;
-    }
+    error_propagate(errp, local_err);
 static void xilinx_axidma_init(Object *obj)
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
index b670184..5ffa739 100644
--- a/hw/net/xilinx_axienet.c
+++ b/hw/net/xilinx_axienet.c
@@ -981,9 +981,7 @@ static void xilinx_enet_realize(DeviceState *dev, Error 
-    if (!*errp) {
-        *errp = local_err;
-    }
+    error_propagate(errp, local_err);
 static void xilinx_enet_init(Object *obj)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]