qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] qemu-sockets: simplify error handling
@ 2016-01-22 11:28 Paolo Bonzini
  2016-01-22 11:31 ` [Qemu-trivial] [Qemu-devel] " Daniel P. Berrange
  2016-01-30  9:37 ` [Qemu-trivial] " Michael Tokarev
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-01-22 11:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Just go always through the err label.  (Noticed because Coverity
complains that peer is always non-NULL in the error cleanup code,
but removing the "if" is arguably more prone to introducing the
opposite bug in the future).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/qemu-sockets.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index f455a17..a9fed00 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -464,7 +464,7 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
 
     if (err) {
         error_propagate(errp, err);
-        return -1;
+        goto err;
     }
 
     addr = sraddr->host;
@@ -474,13 +474,13 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr,
     }
     if (port == NULL || strlen(port) == 0) {
         error_setg(errp, "remote port not specified");
-        return -1;
+        goto err;
     }
 
     if (0 != (rc = getaddrinfo(addr, port, &ai, &peer))) {
         error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
                    gai_strerror(rc));
-	return -1;
+	goto err;
     }
 
     /* lookup local addr */
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH] qemu-sockets: simplify error handling
  2016-01-22 11:28 [Qemu-trivial] [PATCH] qemu-sockets: simplify error handling Paolo Bonzini
@ 2016-01-22 11:31 ` Daniel P. Berrange
  2016-01-30  9:37 ` [Qemu-trivial] " Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2016-01-22 11:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-trivial, qemu-devel

On Fri, Jan 22, 2016 at 12:28:33PM +0100, Paolo Bonzini wrote:
> Just go always through the err label.  (Noticed because Coverity
> complains that peer is always non-NULL in the error cleanup code,
> but removing the "if" is arguably more prone to introducing the
> opposite bug in the future).
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-trivial] [PATCH] qemu-sockets: simplify error handling
  2016-01-22 11:28 [Qemu-trivial] [PATCH] qemu-sockets: simplify error handling Paolo Bonzini
  2016-01-22 11:31 ` [Qemu-trivial] [Qemu-devel] " Daniel P. Berrange
@ 2016-01-30  9:37 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2016-01-30  9:37 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-trivial

22.01.2016 14:28, Paolo Bonzini wrote:
> Just go always through the err label.  (Noticed because Coverity
> complains that peer is always non-NULL in the error cleanup code,
> but removing the "if" is arguably more prone to introducing the
> opposite bug in the future).

Applied to -trivial, thanks!

/mjt


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-30  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-22 11:28 [Qemu-trivial] [PATCH] qemu-sockets: simplify error handling Paolo Bonzini
2016-01-22 11:31 ` [Qemu-trivial] [Qemu-devel] " Daniel P. Berrange
2016-01-30  9:37 ` [Qemu-trivial] " Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).