rcu: Silence compiler array out-of-bounds false positive
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 29 Nov 2012 21:49:00 +0000 (13:49 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 8 Jan 2013 22:15:25 +0000 (14:15 -0800)
commit4930521ae10fd28ebc713107fd243c8044a95415
tree16b199df6f2bd65a9915ac63e29c6b0f8584097d
parent1bdc2b7d243dc8b9aadfc8002a69cf911e9e3e72
rcu: Silence compiler array out-of-bounds false positive

It turns out that gcc 4.8 warns on array indexes being out of bounds
unless it can prove otherwise.  It gives this warning on some RCU
initialization code.  Because this is far from any fastpath, add
an explicit check for array bounds and panic if so.  This gives the
compiler enough information to figure out that the array index is never
out of bounds.

However, if a similar false positive occurs on a fastpath, it will
probably be necessary to tell the compiler to keep its array-index
anxieties to itself.  ;-)

Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
kernel/rcutree.c