[libvirt] [PATCH] lxc: fix logic bug

Eric Blake eblake at redhat.com
Sat Oct 8 02:46:27 UTC 2011


Detected by Coverity.  We want to increment the size_t counter,
not the pointer to the counter.

* src/lxc/lxc_controller.c (lxcSetupLoopDevices): Use correct
precedence.
---

Pushing under the trivial rule.

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

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 52d382e..51488e7 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -210,7 +210,7 @@ static int lxcSetupLoopDevices(virDomainDefPtr def, size_t *nloopDevs, int **loo
             virReportOOMError();
             goto cleanup;
         }
-        (*loopDevs)[*nloopDevs++] = fd;
+        (*loopDevs)[(*nloopDevs)++] = fd;
     }

     VIR_DEBUG("Setup all loop devices");
-- 
1.7.4.4




More information about the libvir-list mailing list