[PATCH] Found minor bug in topology code

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

 



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@xxxxxxxxxx

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