percpu: off by one in BUG_ON()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 29 Oct 2014 08:45:04 +0000 (11:45 +0300)
committerTejun Heo <tj@kernel.org>
Wed, 29 Oct 2014 14:34:34 +0000 (10:34 -0400)
The unit_map[] array has "nr_cpu_ids" number of elements.  It's
allocated a few lines earlier in the function.  So this test should be
>= instead of >.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
mm/percpu.c

index 014bab65e0ffd82bac0e535cf267d28bfbd09902..d39e2f4e335c36497520b02859c02eb7f46f220f 100644 (file)
@@ -1591,7 +1591,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
                        if (cpu == NR_CPUS)
                                continue;
 
-                       PCPU_SETUP_BUG_ON(cpu > nr_cpu_ids);
+                       PCPU_SETUP_BUG_ON(cpu >= nr_cpu_ids);
                        PCPU_SETUP_BUG_ON(!cpu_possible(cpu));
                        PCPU_SETUP_BUG_ON(unit_map[cpu] != UINT_MAX);