xm: Fix xm vcpu-pin to complain for CPU numbers out of range.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
Keir Fraser committed 2008-02-20 17:42:12 +00:00
1 parent 474bc9e5bc
commit 60cbee2041
1 file changed
+10 -1
+10 -1
View File
@@ -227,7 +227,16 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
{
cpumap = 0ULL;
for ( i = 0; i < PyList_Size(cpulist); i++ )
cpumap |= (uint64_t)1 << PyInt_AsLong(PyList_GetItem(cpulist, i));
{
long cpu = PyInt_AsLong(PyList_GetItem(cpulist, i));
if ( cpu >= 64 )
{
errno = EINVAL;
PyErr_SetFromErrno(xc_error_obj);
return NULL;
}
cpumap |= (uint64_t)1 << cpu;
}
}
if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap) != 0 )
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.