diff mbox series

[4/4] util: Fixing invalid error checking from virPCIGetNetname()

Message ID 20181110125624.1168-5-radoslaw.biernacki@linaro.org
State Superseded
Headers show
Series util: Fixing libvirt errors on cavium/thunder-nicvf | expand

Commit Message

Radoslaw Biernacki Nov. 10, 2018, 12:56 p.m. UTC
linkdev is In/Out function parameter as second order reference pointer
so requires first order dereference for checking NULLs which can be a
result from virPCIGetNetName()

Fixes: d6ee56d7237 (util: change virPCIGetNetName() to not return error if device has no net name)
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>

---
 src/util/virhostdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.14.1

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

Comments

Michal Prívozník Nov. 15, 2018, 11:23 a.m. UTC | #1
On 11/10/2018 01:56 PM, Radoslaw Biernacki wrote:
> linkdev is In/Out function parameter as second order reference pointer

> so requires first order dereference for checking NULLs which can be a

> result from virPCIGetNetName()

> 

> Fixes: d6ee56d7237 (util: change virPCIGetNetName() to not return error if device has no net name)

> Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>

> ---

>  src/util/virhostdev.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 1898f9eeb9..1d9345beda 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -317,7 +317,7 @@  virHostdevNetDevice(virDomainHostdevDefPtr hostdev,
         if (virPCIGetNetName(sysfs_path, 0, NULL, linkdev) < 0)
             return -1;
 
-        if (!linkdev) {
+        if (!(*linkdev)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("The device at %s has no network device name"),
                            sysfs_path);