On Mon, Sep 16, 2019 at 10:19:08AM +0200, Geert Uytterhoeven wrote:
> On Mon, Sep 16, 2019 at 9:43 AM Geert Uytterhoeven <ge...@linux-m68k.org> 
> wrote:
> > JFYI, when comparing v5.3[1] to v5.3-rc8[3], the summaries are:
> >   - build errors: +0/-0
> >   - build warnings: +50/-50
> 
> Just the levelspread noise.
> Anyone with an idea to get rid of it (and to prove they're all 
> false-positives)?
> 
> > [1] 
> > http://kisskb.ellerman.id.au/kisskb/branch/linus/head/4d856f72c10ecb060868ed10ff1b1453943fc6c8/
> >  (all 242 configs)
> > [3] 
> > http://kisskb.ellerman.id.au/kisskb/branch/linus/head/f74c2bb98776e2de508f4d607cd519873065118e/
> >  (all 242 configs)
> 
> > 122 warning regressions:
> 
> >   + /kisskb/src/kernel/rcu/srcutree.c: warning: 'levelspread[<U aa0>]' may 
> > be used uninitialized in this function [-Wuninitialized]:  => 121:34

Looks to me like rcu_init_levelspread() unconditionally initializes all
of the elements.  I suppose that I could stomp the unused portion of
the array, as in the following (untested) patch.

Thoughts?

                                                        Thanx, Paul

------------------------------------------------------------------------

diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index aeec70f..ab504fb 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -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--)

Reply via email to