[PATCH] Properly check the return value of CCWAddressAsString

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It returns NULL on failure. Checking if the negation of it
is less than zero makes no sense. (Found by coverity after moving
the code)

In another case, the return value wasn't checked at all.
---
 src/conf/domain_addr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index a756f12..fb4a76f 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -614,7 +614,7 @@ virDomainCCWAddressAssign(virDomainDeviceInfoPtr dev,
             goto cleanup;
         }
     } else if (autoassign && !dev->addr.ccw.assigned) {
-        if (!(addr = virDomainCCWAddressAsString(&addrs->next)) < 0)
+        if (!(addr = virDomainCCWAddressAsString(&addrs->next)))
             goto cleanup;
 
         while (virHashLookup(addrs->defined, addr)) {
@@ -624,7 +624,8 @@ virDomainCCWAddressAssign(virDomainDeviceInfoPtr dev,
                 goto cleanup;
             }
             VIR_FREE(addr);
-            addr = virDomainCCWAddressAsString(&addrs->next);
+            if (!(addr = virDomainCCWAddressAsString(&addrs->next)))
+                goto cleanup;
         }
         dev->addr.ccw = addrs->next;
         dev->addr.ccw.assigned = true;
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]