]> Git Repo - qemu.git/commitdiff
chardev-socket: remove useless if
authorPaolo Bonzini <[email protected]>
Tue, 20 Mar 2018 15:18:43 +0000 (16:18 +0100)
committerPaolo Bonzini <[email protected]>
Mon, 26 Mar 2018 12:37:14 +0000 (14:37 +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 <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
chardev/char-socket.c

index d057192ced0acb82f030f1f00ce58b7c41c02f36..159e69c3b15a58f9593374853a36cd752c69f31b 100644 (file)
@@ -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,
This page took 0.026661 seconds and 4 git commands to generate.