[PATCH] lxc: Fix coverity findings

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

 



Fix lxc related coverity findings...

Error: UNINIT:
/libvirt/src/lxc/lxc_driver.c:1412:
var_decl: Declaring variable "fd" without initializer.
/libvirt/src/lxc/lxc_driver.c:1460:
uninit_use_in_call: Using uninitialized value "fd" when calling "virFileClose".
/libvirt/src/util/virfile.c:50:
read_parm: Reading a parameter value.

Error: DEADCODE:
/libvirt/src/lxc/lxc_controller.c:960:
dead_error_condition: On this path, the condition "ret == 4" cannot be true.
/libvirt/src/lxc/lxc_controller.c:959:
at_most: After this line, the value of "ret" is at most -1.
/libvirt/src/lxc/lxc_controller.c:959:
new_values: Noticing condition "ret < 0".
/libvirt/src/lxc/lxc_controller.c:961:
dead_error_line: Execution cannot reach this statement "continue;".

Error: UNINIT:
/libvirt/src/lxc/lxc_controller.c:1104:
var_decl: Declaring variable "consoles" without initializer.
/libvirt/src/lxc/lxc_controller.c:1237:
uninit_use: Using uninitialized value "consoles".

---
 src/lxc/lxc_controller.c |    4 ++--
 src/lxc/lxc_driver.c     |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Index: libvirt-acl/src/lxc/lxc_driver.c
===================================================================
--- libvirt-acl.orig/src/lxc/lxc_driver.c
+++ libvirt-acl/src/lxc/lxc_driver.c
@@ -1409,7 +1409,7 @@ static int lxcMonitorClient(lxc_driver_t
                             virDomainObjPtr vm)
 {
     char *sockpath = NULL;
-    int fd;
+    int fd = -1;
     struct sockaddr_un addr;

     if (virAsprintf(&sockpath, "%s/%s.sock",
Index: libvirt-acl/src/lxc/lxc_controller.c
===================================================================
--- libvirt-acl.orig/src/lxc/lxc_controller.c
+++ libvirt-acl/src/lxc/lxc_controller.c
@@ -957,7 +957,7 @@ static void lxcEpollIO(int watch, int fd
         int ret;
         ret = epoll_wait(console->epollFd, &event, 1, 0);
         if (ret < 0) {
-            if (ret == EINTR)
+            if (errno == EINTR)
                 continue;
             virReportSystemError(errno, "%s",
                                  _("Unable to wait on epoll"));
@@ -1101,7 +1101,7 @@ static int lxcControllerMain(int serverF
                              size_t nFds,
                              pid_t container)
 {
-    struct lxcConsole *consoles;
+    struct lxcConsole *consoles = NULL;
     struct lxcMonitor monitor = {
         .serverFd = serverFd,
         .clientFd = clientFd,

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