[PATCH] domain_addr: Resolve Coverity warning

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

 



Recent changes in the module :

http://www.redhat.com/archives/libvir-list/2014-June/msg00978.html

seem to have caused Coverity to "take a look"...

The virDomainCCWAddressAsString() API returns either a NULL or a string
and the comparison of the returned value to "< 0" caused following errors:

[1] CONSTANT_EXPRESSION_RESULT
(1) Event result_independent_of_operands:
     "!(addr = virDomainCCWAddressAsString(&addrs->next)) < 0" is always
     false regardless of the values of its operands. This occurs as the
     logical operand of if.

and

2] DEADCODE
(1) Event between:
     At condition "!(addr = virDomainCCWAddressAsString(&addrs->next)) < 0",
     the value of "addr = virDomainCCWAddressAsString(&addrs->next)" must
     be between 0 and 1.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_addr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index a756f12..4a14ee0 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)) {
-- 
1.9.3

--
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]