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

[Libvir] [PATCH] Found minor bug in topology code



I found a problem with an error path... I was cutting off incrementing of a value in the loop then checking if it was too big after the loop, so the way it was structured, it could never happen. Here is the fix.


--
Elizabeth Kon (Beth)
IBM Linux Technology Center
Open Hypervisor Team
email: eak us ibm com

Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.145
diff -u -r1.145 xend_internal.c
--- src/xend_internal.c	30 Sep 2007 15:36:47 -0000	1.145
+++ src/xend_internal.c	3 Oct 2007 14:38:33 -0000
@@ -2006,15 +2006,15 @@
                     goto error;
 
                 }
-                for (i=start; i<=finish && nodeCpuCount<numCpus; i++) {
+                for (i=start; i<=finish; i++) {
+                    nodeCpuCount++;
+                    if (nodeCpuCount > numCpus) {
+                        virXendError(conn, VIR_ERR_XEN_CALL, 
+                                     "conflicting cpu counts");
+                        goto error;
+                    }
                     *(cpuIdsPtr++) = i;
                     cellCpuCount++;
-                    nodeCpuCount++;
-                }
-                if (nodeCpuCount > numCpus) {
-                    virXendError(conn, VIR_ERR_XEN_CALL, 
-                                 "conflicting cpu counts");
-                    goto error;
                 }
                 offset += len;
                 next = *(offset);

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