linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch] percpu: off by one in BUG_ON()
@ 2014-10-29  8:45 Dan Carpenter
  2014-10-29 14:35 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-10-29  8:45 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Christoph Lameter, linux-mm, kernel-janitors

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>
---
Static checker stuff.  Not tested.

diff --git a/mm/percpu.c b/mm/percpu.c
index 014bab6..d39e2f4 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);
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] percpu: off by one in BUG_ON()
  2014-10-29  8:45 [patch] percpu: off by one in BUG_ON() Dan Carpenter
@ 2014-10-29 14:35 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2014-10-29 14:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Christoph Lameter, linux-mm, kernel-janitors

On Wed, Oct 29, 2014 at 11:45:04AM +0300, Dan Carpenter wrote:
> 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>

Applied to percpu/for-3.19.

Thanks.

-- 
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-29 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-29  8:45 [patch] percpu: off by one in BUG_ON() Dan Carpenter
2014-10-29 14:35 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox