[libvirt PATCH v2 06/10] udevProcessCCW: Initialize variable

Tim Wiederhake twiederh at redhat.com
Mon Feb 1 12:42:03 UTC 2021


`udevGetIntSysfsAttr` does not necessarily write to the third parameter,
even when it returns 0.

This was found by clang-tidy's
"clang-analyzer-core.UndefinedBinaryOperatorResult" check.

Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/node_device/node_device_udev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index fceb135aa5..09048fb23f 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1100,7 +1100,7 @@ static int
 udevProcessCCW(struct udev_device *device,
                virNodeDeviceDefPtr def)
 {
-    int online;
+    int online = 0;
 
     /* process only online devices to keep the list sane */
     if (udevGetIntSysfsAttr(device, "online", &online, 0) < 0 || online != 1)
-- 
2.26.2




More information about the libvir-list mailing list