Skip to content

Commit

Permalink
percpu: off by one in BUG_ON()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
Dan Carpenter authored and htejun committed Oct 29, 2014
1 parent cac7f24 commit 9f29566
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9f29566

Please sign in to comment.