From 85528f75ade054dced9103f8f002aa6275df6a24 Mon Sep 17 00:00:00 2001 Message-Id: <85528f75ade054dced9103f8f002aa6275df6a24@dist-git> From: Laine Stump Date: Mon, 14 Aug 2017 21:28:23 -0400 Subject: [PATCH] util: fix improper assignment of return value in virHostdevReadNetConfig() Commit 9a94af6d restructured virHostdevReadNetConfig() so that it would manually set ret = 0 after successfully reading the device's config, but Coverity pointed out that "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. Resolves: https://bugzilla.redhat.com/1460082 (cherry picked from commit 83074cc917615c8c2c9e147cbd6918812330fd0d) Signed-off-by: Jiri Denemark --- 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 cca9d81a4c..a12224c58f 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.14.1