[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] virtio-serial-bus: send_control_msg should
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 1/1] virtio-serial-bus: send_control_msg should not deal with cpkts |
Date: |
Mon, 17 Dec 2012 14:14:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
Amit Shah <address@hidden> writes:
> Stuff the cpkt before calling send_control_msg(). it should not be
> concerned about contents, just send across the buffer.
>
> A few code refactorings recently have made mkaing this change easier
> than earlier.
>
> Coverity and clang have flagged this code several times in the past
> (cpkt->id not set before send_control_event() passed it on to
> send_control_msg()). This will finally eliminate the false-positive.
>
> CC: Markus Armbruster <address@hidden>
> Signed-off-by: Amit Shah <address@hidden>
Patch makes sense to me, and the Coverity defect report is gone.
However, it now worries find_port_by_id() in remove_port() could return
a null pointer, which is then dereferenced. No idea why it didn't
report that before. Obvious suppressor:
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 47d0481..7ff7505 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -826,6 +826,7 @@ static void remove_port(VirtIOSerial *vser, uint32_t
port_id)
vser->ports_map[i] &= ~(1U << (port_id % 32));
port = find_port_by_id(vser, port_id);
+ assert(port);
/* Flush out any unconsumed buffers first */
discard_vq_data(port->ovq, &port->vser->vdev);
Reviewed-by: Markus Armbruster <address@hidden>