[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54fff30b-4662-48c7-8b87-2e8f74d2086b@kadam.mountain>
Date: Tue, 25 Jul 2023 07:33:37 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Su Hui <suhui@...china.com>, tytso@....edu,
adilger.kernel@...ger.ca, nathan@...nel.org, trix@...hat.com,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] ext4: mballoc: avoid garbage value from err
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@...china.com> 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@...china.com>
>
> 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
Powered by blists - more mailing lists