python: xc: fix max_cpu_index sign error
PATCH 1/1 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.
--- tools/python/xen/lowlevel/xc/xc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/python/xen/lowlevel/xc/xc.c +1 -1
@@ -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);
Signature · 12 lines
2.7.3.AMZN Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
CC Marek
Quoted 35 lines · Petre Eftime
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 <[email protected]>--- tools/python/xen/lowlevel/xc/xc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/python/xen/lowlevel/xc/xc.c +1
-1@@ -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);Signature · 12 lines
2.7.3.AMZN Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Marek Marczykowski-Górecki
Acked-byQuoted 8 lines · Wei Liu
CC Marek
Quoted 5 lines · Petre Eftime
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 <[email protected]>
Quoted 30 lines
Quoted 30 lines
--- tools/python/xen/lowlevel/xc/xc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/python/xen/lowlevel/xc/xc.c +1
-1@@ -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);Signature · 12 lines
2.7.3.AMZN Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Signature · 5 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Marek Marczykowski-Górecki
Quoted 8 lines · Wei Liu
CC Marek
Quoted 5 lines · Petre Eftime
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 <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel