public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch -next] rcu: off by one in gp_state_getname()
@ 2015-11-19 19:34 Dan Carpenter
  2015-11-19 21:18 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2015-11-19 19:34 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	linux-kernel, kernel-janitors

It should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

Fixes: 6231da675578 ('rcu: Print symbolic name for ->gp_state')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 6a5e1c4..6559b3c 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -1203,7 +1203,7 @@ static void record_gp_stall_check_time(struct rcu_state *rsp)
  */
 static char *gp_state_getname(short gs)
 {
-	if (gs < 0 || gs > ARRAY_SIZE(gp_state_names))
+	if (gs < 0 || gs >= ARRAY_SIZE(gp_state_names))
 		return "???";
 	return gp_state_names[gs];
 }

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

end of thread, other threads:[~2015-11-20 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 19:34 [patch -next] rcu: off by one in gp_state_getname() Dan Carpenter
2015-11-19 21:18 ` Paul E. McKenney
2015-11-20 10:30   ` Dan Carpenter
2015-11-20 11:33     ` Paul E. McKenney

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