lkml.org 
[lkml]   [2015]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch -next] rcu: off by one in gp_state_getname()
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];
}

\
 
 \ /
  Last update: 2015-11-19 20:41    [W:0.053 / U:1.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site