chardev-socket: remove useless if
PATCH 1/1 chardev-socket: remove useless if
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.
--- chardev/char-socket.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
chardev/char-socket.c +4 -6
@@ -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,
Signature · 1 line
2.16.2
Quoted 7 lines · Paolo Bonzini
This trips Coverity, which believes the subsequent
qio_channel_create_watchcan dereference a NULL pointer. In reality, tcp_chr_connect's callers all haves->iocproperly initialized, since they are all rooted attcp_chr_new_client.Signed-off-by Paolo Bonzini <[email protected]>---
Quoted 28 lines
chardev/char-socket.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)chardev/char-socket.c +4
-7@@ -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, --2.16.2
Signature · 1 line
Marc-André Lureau
Quoted 6 lines · Paolo Bonzini
This trips Coverity, which believes the subsequent
qio_channel_create_watchcan dereference a NULL pointer. In reality, tcp_chr_connect's callers all haves->iocproperly initialized, since they are all rooted attcp_chr_new_client.Signed-off-by Paolo Bonzini <[email protected]>
(maybe replacing with an assertion would be nicer? No big deal.)
Signature · 1 line
Peter Xu
Quoted 9 lines · Peter Xu
Quoted 6 lines · Paolo Bonzini
This trips Coverity, which believes the subsequent
qio_channel_create_watchcan dereference a NULL pointer. In reality, tcp_chr_connect's callers all haves->iocproperly initialized, since they are all rooted attcp_chr_new_client.Signed-off-by Paolo Bonzini <[email protected]>(maybe replacing with an assertion would be nicer? No big deal.)
It's already asserting, it just raises SIGSEGV instead of SIGABRT. :)
Paolo
Quoted 7 lines · Paolo Bonzini
Quoted 6 lines · Peter Xu
Quoted 5 lines · Paolo Bonzini
This trips Coverity, which believes the subsequent
qio_channel_create_watchcan dereference a NULL pointer. In reality, tcp_chr_connect's callers all haves->iocproperly initialized, since they are all rooted attcp_chr_new_client.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Paolo Bonzini <[email protected]>(maybe replacing with an assertion would be nicer? No big deal.)
It's already asserting, it just raises SIGSEGV instead of SIGABRT. :)
Ah yes it's in the next qio_channel_create_watch(). :)
Signature · 1 line
Peter Xu