[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/16] chardev-socket: remove useless if
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 12/16] chardev-socket: remove useless if |
Date: |
Mon, 26 Mar 2018 15:36:39 +0200 |
This trips Coverity, which believes the subsequent qio_channel_create_watch
can dereference a NULL pointer. In reality, tcp_chr_connect's callers
all have s->ioc properly initialized, since they are all rooted at
tcp_chr_new_client.
Reviewed-by: Marc-André Lureau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
chardev/char-socket.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index d057192..159e69c 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -550,12 +550,10 @@ static void tcp_chr_connect(void *opaque)
s->is_listen, s->is_telnet);
s->connected = 1;
- if (s->ioc) {
- chr->gsource = io_add_watch_poll(chr, s->ioc,
- tcp_chr_read_poll,
- tcp_chr_read,
- chr, chr->gcontext);
- }
+ chr->gsource = io_add_watch_poll(chr, s->ioc,
+ tcp_chr_read_poll,
+ tcp_chr_read,
+ chr, chr->gcontext);
s->hup_source = qio_channel_create_watch(s->ioc, G_IO_HUP);
g_source_set_callback(s->hup_source, (GSourceFunc)tcp_chr_hup,
--
1.8.3.1
- [Qemu-devel] [PULL 04/16] WHPX improve vcpu_post_run perf, (continued)
- [Qemu-devel] [PULL 04/16] WHPX improve vcpu_post_run perf, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 05/16] hw/net/can: Fix segfaults when using the devices without bus, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 01/16] scripts/get_maintainer.pl: Print proper error message for missing $file, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 07/16] hw/audio: Fix crashes when devices are used on ISA bus without DMA, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 06/16] fdc: Exit if ISA controller does not support DMA, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 08/16] scripts/device-crash-test: Remove fixed isapc-with-iommu entry, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 09/16] vhost-user-test: do not hang if chardev creation failed, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 11/16] tcg: Really fix cpu_io_recompile, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 12/16] chardev-socket: remove useless if,
Paolo Bonzini <=
- [Qemu-devel] [PULL 13/16] scsi: turn "is this a SCSI device?" into a conditional hint, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 14/16] iothread: fix breakage on windows, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 15/16] chardev/char-fe: Allow NULL chardev in qemu_chr_fe_init(), Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 10/16] vhost-user-test: add back memfd check, Paolo Bonzini, 2018/03/26
- [Qemu-devel] [PULL 16/16] qemu-pr-helper: Actually allow users to specify pidfile, Paolo Bonzini, 2018/03/26
- Re: [Qemu-devel] [PULL 00/16] Misc fixes for QEMU 2.12.0-rc1, Peter Maydell, 2018/03/27