]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rcu: Suppress levelspread uninitialized messages
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 18 Sep 2019 17:10:31 +0000 (10:10 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 30 Oct 2019 15:34:53 +0000 (08:34 -0700)
New tools bring new warnings, and with v5.3 comes:

kernel/rcu/srcutree.c: warning: 'levelspread[<U aa0>]' may be used uninitialized in this function [-Wuninitialized]:  => 121:34

This commit suppresses this warning by initializing the full array
to INT_MIN, which will result in failures should any out-of-bounds
references appear.

Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
kernel/rcu/rcu.h

index 8fd4f82c9b3d7f0dc9a073976e62923901d4ddd0..b64c707f60655032c2410c680cc7da9cbdb13d23 100644 (file)
@@ -299,6 +299,8 @@ static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt)
 {
        int i;
 
+       for (i = 0; i < RCU_NUM_LVLS; i++)
+               levelspread[i] = INT_MIN;
        if (rcu_fanout_exact) {
                levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
                for (i = rcu_num_lvls - 2; i >= 0; i--)