[PATCH 6/14] cpumask: use cpu_online in kernel/perf_event.c

From: Rusty Russell
Date: Mon Nov 02 2009 - 23:27:06 EST



Also, we want to check against nr_cpu_ids, not num_possible_cpus().
The latter works, but the correct bounds check is < nr_cpu_ids.

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
To: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
kernel/perf_event.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1596,7 +1596,7 @@ static struct perf_event_context *find_g
if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
return ERR_PTR(-EACCES);

- if (cpu < 0 || cpu > num_possible_cpus())
+ if (cpu < 0 || cpu >= nr_cpu_ids)
return ERR_PTR(-EINVAL);

/*
@@ -1604,7 +1604,7 @@ static struct perf_event_context *find_g
* offline CPU and activate it when the CPU comes up, but
* that's for later.
*/
- if (!cpu_isset(cpu, cpu_online_map))
+ if (!cpu_online(cpu))
return ERR_PTR(-ENODEV);

cpuctx = &per_cpu(perf_cpu_context, cpu);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/