ia64/xen-unstable

changeset 17092:511ab2b89ced

xm: Fix xm vcpu-pin to complain for CPU numbers out of range.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 20 17:42:12 2008 +0000 (2008-02-20)
parents 6757307d1adc
children e3c722d483f5
files tools/python/xen/lowlevel/xc/xc.c
line diff
     1.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed Feb 20 17:38:19 2008 +0000
     1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Wed Feb 20 17:42:12 2008 +0000
     1.3 @@ -227,7 +227,16 @@ static PyObject *pyxc_vcpu_setaffinity(X
     1.4      {
     1.5          cpumap = 0ULL;
     1.6          for ( i = 0; i < PyList_Size(cpulist); i++ ) 
     1.7 -            cpumap |= (uint64_t)1 << PyInt_AsLong(PyList_GetItem(cpulist, i));
     1.8 +        {
     1.9 +            long cpu = PyInt_AsLong(PyList_GetItem(cpulist, i));
    1.10 +            if ( cpu >= 64 )
    1.11 +            {
    1.12 +                errno = EINVAL;
    1.13 +                PyErr_SetFromErrno(xc_error_obj);
    1.14 +                return NULL;
    1.15 +            }
    1.16 +            cpumap |= (uint64_t)1 << cpu;
    1.17 +        }
    1.18      }
    1.19    
    1.20      if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap) != 0 )