[libvirt] [PATCH 4/4] libxl: Resolve Coverity CHECKED_RETURN

John Ferlan jferlan at redhat.com
Mon Dec 1 16:33:57 UTC 2014


Commit id 'cb88d433' refactored the calling sequence to use a thread;
however, in doing so "lost" the check for if virNetSocketAccept returns
failure.  Since other code makes that check, Coverity complains. Although
a false positive, adding back the failure check pacifies Coverity

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/libxl/libxl_migration.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 0caa3d0..4db89b6 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -133,8 +133,7 @@ libxlMigrateReceive(virNetSocketPtr sock,
     size_t i;
 
     /* Accept migration connection */
-    virNetSocketAccept(sock, &client_sock);
-    if (client_sock == NULL) {
+    if (virNetSocketAccept(sock, &client_sock) < 0 || !client_sock) {
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("Failed to accept migration connection"));
         goto fail;
-- 
1.9.3




More information about the libvir-list mailing list