summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-10-27 11:03:33 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2008-10-27 11:03:33 +1100
commit231f4be6e1309183fb959efbb8b008b8bee570ca (patch)
tree2d8cf149c607a81c3457130151343c918306f1bd /lib
parent6c989f9dc3cd4048d8af5df47825d0bff31d7a87 (diff)
cpumask:check-all-ops-for-limits
It's useful to check that no one is accessing > nr_cpumask_bits for cpumasks. This also allows you to turn on CONFIG_CPUMASKS_OFFSTACK even for smaller CONFIG_NR_CPUS. It's a WARN_ON_ONCE because I *know* that UP-configured Cell processor will currently trip this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Mike Travis <travis@sgi.com> Cc: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug6
-rw-r--r--lib/cpumask.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index b0f239e443bc..9c4286760490 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -761,6 +761,12 @@ config SYSCTL_SYSCALL_CHECK
to properly maintain and use. This enables checks that help
you to keep things correct.
+config DEBUG_PER_CPU_MAPS
+ bool "Cpumask debug checks"
+ ---help---
+ Extra debugging for cpumasks.
+ eg. to make sure accesses to cpumasks are < nr_cpu_ids.
+
source kernel/trace/Kconfig
config PROVIDE_OHCI1394_DMA_INIT
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 4795e69e5b63..48f475fd0b89 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -11,6 +11,9 @@ EXPORT_SYMBOL(cpumask_first);
int cpumask_next(int n, const cpumask_t *srcp)
{
+ /* -1 is a legal arg here. */
+ if (n != -1)
+ cpumask_check(n);
return find_next_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1);
}
EXPORT_SYMBOL(cpumask_next);