On Mon, Jul 24, 2023 at 10:19:02AM -0700, Nick Desaulniers wrote: > On Sun, Jul 23, 2023 at 10:46 PM Su Hui <suhui@xxxxxxxxxxxx> wrote: > > > > clang warning: fs/ext4/mballoc.c, line 4178, column 6 > > Branch condition evaluates to a garbage value. > > Specifically this is clang's static analysis; not the compiler itself. > > > > > err is uninitialized and will be judged when it enters the > > loop first time and the condition "!ext4_sb_block_valid()" > > is true. Although this can't make problems now, it's better > > to correct it. > > > > Signed-off-by: Su Hui <suhui@xxxxxxxxxxxx> > > Hi Su, > Thanks for the patch! I see what the warning is getting at; > > If `len <= 0` then `err` is never initialized, then is used at line > 4178 (that is UB). > > Would you mind sending a v2 with the commit message updated to reflect > the above points? I'd be happy to sign-off on that. The commit message talks about !ext4_sb_block_valid() on the first iteration through the loop and not that len <= 0. But either way, brelse(NULL) is a no-op. regards, dan carpenter