From f377678692caa9f589275eae4f2774104f26a8c6 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Thu, 15 Sep 2011 11:01:38 -0400 Subject: [PATCH] init maxcpus before use [ Edit: Covers the per-cpu call_rcu data setup (not all_cpus helper, which is why we did not trigger it in our tests. ] Signed-off-by: Lai Jiangshan Signed-off-by: Mathieu Desnoyers --- urcu-call-rcu-impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/urcu-call-rcu-impl.h b/urcu-call-rcu-impl.h index 700d128..e0a8fd8 100644 --- a/urcu-call-rcu-impl.h +++ b/urcu-call-rcu-impl.h @@ -386,6 +386,7 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp) static int warned = 0; call_rcu_lock(&call_rcu_mutex); + alloc_cpu_call_rcu_data(); if (cpu < 0 || maxcpus <= cpu) { if (!warned) { fprintf(stderr, "[error] liburcu: set CPU # out of range\n"); @@ -395,7 +396,6 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp) errno = EINVAL; return -EINVAL; } - alloc_cpu_call_rcu_data(); call_rcu_unlock(&call_rcu_mutex); if (per_cpu_call_rcu_data == NULL) { errno = ENOMEM; -- 2.34.1