[PATCH 1/2] util: fix Coverity complaint (and actual bug) in virHostdevReadNetConfig()

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

 



Commit 9a94af6d restructured virHostdevReadNetConfig() so that it
would manually set ret = 0 after successfully reading the device's
config, but the "ret = 0" was erroneously placed outside of an "else"
clause, meaning that the the value of ret set in the "if" clause was
unnecessarily and incorrectly overwritten.

This patch moves ret = 0 into the else clause, which should silence
Coverity.
---
 src/util/virhostdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index cca9d81a4..a12224c58 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -641,9 +641,9 @@ virHostdevRestoreNetConfig(virDomainHostdevDefPtr hostdev,
 
         ignore_value(virNetDevSetNetConfig(linkdev, vf,
                                            adminMAC, vlan, MAC, true));
+        ret = 0;
     }
 
-    ret = 0;
  cleanup:
     VIR_FREE(linkdev);
     VIR_FREE(MAC);
-- 
2.13.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]
  Powered by Linux