public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] SUNRPC: off by one in BUG_ON()
@ 2014-10-29  8:44 Dan Carpenter
  2014-10-29 15:38 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-10-29  8:44 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: Trond Myklebust, David S. Miller, linux-nfs, netdev,
	kernel-janitors

The m->pool_to[] array has "maxpools" number of elements.  It's
allocated in svc_pool_map_alloc_arrays() which we called earlier in the
function.  This test should be >= instead of >.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is very old code, but hopefully the off by one doesn't affect
runtime.

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index ca8a795..349c98f 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -189,7 +189,7 @@ svc_pool_map_init_percpu(struct svc_pool_map *m)
 		return err;
 
 	for_each_online_cpu(cpu) {
-		BUG_ON(pidx > maxpools);
+		BUG_ON(pidx >= maxpools);
 		m->to_pool[cpu] = pidx;
 		m->pool_to[pidx] = cpu;
 		pidx++;

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

end of thread, other threads:[~2014-10-29 15:38 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:44 [patch] SUNRPC: off by one in BUG_ON() Dan Carpenter
2014-10-29 15:38 ` J. Bruce Fields

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