diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2017-06-08 10:39:02 -0300 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-07-13 13:45:53 +0200 |
commit | a9859c90a5db200fd4f63ab2cdc973343348b9ef (patch) | |
tree | b6b4df511b6b2c84d26e6cfd9cf15855a88818a0 /hw | |
parent | 31fe1c414501047cbb91b695bdccc0068496dcf6 (diff) |
xilinx: Fix latent error handling bug
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" <edgar.iglesias@gmail.com>
Cc: Alistair Francis <alistair.francis@xilinx.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-arm@nongnu.org
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170608133906.12737-2-ehabkost@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message clarified]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/dma/xilinx_axidma.c | 4 | ||||
-rw-r--r-- | 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 6065689ad1..3987b5ff96 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 **errp) return; xilinx_axidma_realize_fail: - 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 b6701844d3..5ffa739f68 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 **errp) return; xilinx_enet_realize_fail: - if (!*errp) { - *errp = local_err; - } + error_propagate(errp, local_err); } static void xilinx_enet_init(Object *obj) |