From: Dan Carpenter Date: Wed, 29 Oct 2014 08:45:04 +0000 (+0300) Subject: percpu: off by one in BUG_ON() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9f295664e2f2cdf53c596f74bcf3f644cae9fecc;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git percpu: off by one in BUG_ON() 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 Signed-off-by: Tejun Heo --- diff --git a/mm/percpu.c b/mm/percpu.c index 014bab65e0ff..d39e2f4e335c 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -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);