]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
python: xc: fix max_cpu_index sign error
authorPetre Eftime <epetre@amazon.com>
Thu, 5 Apr 2018 12:49:23 +0000 (12:49 +0000)
committerWei Liu <wei.liu2@citrix.com>
Fri, 6 Apr 2018 08:05:28 +0000 (09:05 +0100)
When 0-indexing, maximum index is num_entries - 1. The python xc library had a
sign error where the minus was replaced by a plus, making tools that depended
on it to look for CPUs that did not exist.

Signed-off-by: Petre Eftime <epetre@amazon.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
tools/python/xen/lowlevel/xc/xc.c

index f501764100ad341801615352efa8bcd72f319b7d..694bfa0642723652cda136077803f5b0d658e632 100644 (file)
@@ -1079,7 +1079,7 @@ static PyObject *pyxc_topologyinfo(XcObject *self)
         }
     }
 
-    ret_obj = Py_BuildValue("{s:i}", "max_cpu_index", num_cpus + 1);
+    ret_obj = Py_BuildValue("{s:i}", "max_cpu_index", num_cpus - 1);
 
     PyDict_SetItemString(ret_obj, "cpu_to_core", cpu_to_core_obj);
     Py_DECREF(cpu_to_core_obj);