From: Petre Eftime Date: Thu, 5 Apr 2018 12:49:23 +0000 (+0000) Subject: python: xc: fix max_cpu_index sign error X-Git-Tag: 4.11.0-rc1~56 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3bc9c4f98a5dea5afda3ad2aae243e88d12a7e09;p=xen.git python: xc: fix max_cpu_index sign error 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 Acked-by: Marek Marczykowski-Górecki Release-acked-by: Juergen Gross --- diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index f501764100..694bfa0642 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -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);