cpumask <=> xenctl_cpumap: allocate CPU masks and byte maps dynamically
authorJan Beulich <jbeulich@suse.com>
Fri, 21 Oct 2011 07:45:24 +0000 (09:45 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 21 Oct 2011 07:45:24 +0000 (09:45 +0200)
commit47e0eeb7abc98e04fffd7aaa2158a28106048c44
tree5a685e68a284fb535f2db731f86dfa6700bc899c
parentc567ffce5c30d41e46e6c93b6aacf11ed62989cc
cpumask <=> xenctl_cpumap: allocate CPU masks and byte maps dynamically

Generally there was a NR_CPUS-bits wide array in these functions and
another (through a cpumask_t) on their callers' stacks, which may get
a little large for big NR_CPUS. As the functions can fail anyway, do
the allocation in there.

For the x86/MCA case this require a little code restructuring: By using
different CPU mask accessors it was possible to avoid allocating a mask
in the broadcast case. Also, this was the only user that failed to
check the return value of the conversion function (which could have led
to undefined behvior).

Also constify the input parameters of the two functions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/cpu/mcheck/mce.c
xen/arch/x86/platform_hypercall.c
xen/common/domctl.c
xen/common/trace.c
xen/include/xen/cpumask.h