aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/trace.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2011-10-21 09:45:24 +0200
committerJan Beulich <jbeulich@suse.com>2011-10-21 09:45:24 +0200
commit47e0eeb7abc98e04fffd7aaa2158a28106048c44 (patch)
tree5a685e68a284fb535f2db731f86dfa6700bc899c /xen/common/trace.c
parentc567ffce5c30d41e46e6c93b6aacf11ed62989cc (diff)
downloadxen-47e0eeb7abc98e04fffd7aaa2158a28106048c44.tar.gz
xen-47e0eeb7abc98e04fffd7aaa2158a28106048c44.tar.bz2
xen-47e0eeb7abc98e04fffd7aaa2158a28106048c44.zip
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>
Diffstat (limited to 'xen/common/trace.c')
-rw-r--r--xen/common/trace.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xen/common/trace.c b/xen/common/trace.c
index 2253e3114a..746bf4b750 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -378,7 +378,16 @@ int tb_control(xen_sysctl_tbuf_op_t *tbc)
tbc->size = t_info_pages * PAGE_SIZE;
break;
case XEN_SYSCTL_TBUFOP_set_cpu_mask:
- rc = xenctl_cpumap_to_cpumask(&tb_cpu_mask, &tbc->cpu_mask);
+ {
+ cpumask_var_t mask;
+
+ rc = xenctl_cpumap_to_cpumask(&mask, &tbc->cpu_mask);
+ if ( !rc )
+ {
+ cpumask_copy(&tb_cpu_mask, mask);
+ free_cpumask_var(mask);
+ }
+ }
break;
case XEN_SYSCTL_TBUFOP_set_evt_mask:
tb_event_mask = tbc->evt_mask;