mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Dan Carpenter" <dan.carpenter@linaro.org>,
	"Naresh Kamboju" <naresh.kamboju@linaro.org>,
	"Uladzislau Rezki" <urezki@gmail.com>
Cc: linux-next <linux-next@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"Linux Regressions" <regressions@lists.linux.dev>,
	clang-built-linux <llvm@lists.linux.dev>,
	lkft-triage@lists.linaro.org,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized]
Date: Thu, 11 Jan 2024 13:55:15 +0100	[thread overview]
Message-ID: <908325ed-08af-4b0c-926e-da9afba25772@app.fastmail.com> (raw)
In-Reply-To: <628bf675-77fc-4ccc-be2f-9c3ec8a7b0b8@moroto.mountain>

On Thu, Jan 11, 2024, at 12:16, Dan Carpenter wrote:
> On Thu, Jan 11, 2024 at 04:23:09PM +0530, Naresh Kamboju wrote:
>> Following build failures noticed on i386 and x86 with clang builds on the
>> Linux next-20240111 tag.
>> 
>> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>> 
>> Build error:
>> ----------
>> mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when
>> used here [-Werror,-Wuninitialized]
>>  4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
>>       |                                       ^~~~
>> mm/vmalloc.c:4684:20: note: initialize the variable 'addr' to silence
>> this warning
>>  4684 |         unsigned long addr;
>>       |                           ^
>>       |                            = 0
>> 1 error generated.
>
> We turned off uninitialized variable warnings for GCC a long time ago...
> :/ I don't know if we'll be able to re-enable it in a -Werror world
> although Clang seems to be managing alright so perhaps there is hope.

The problem with gcc's warning is that it is non-deterministic and
in recent versions actually got more false-positives even without
-Os or -fsanitize=. Clang does not catch all that gcc does because
it doesn't track state across inline functions, but at least its
output is always the same regardless of optimization and other
options.

At least this particular one is an obvious bug and easily gets
caught by lkft and lkp even if gcc's -Wuninitilized doesn't
flag it.

    Arnd

  reply	other threads:[~2024-01-11 12:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 10:53 Naresh Kamboju
2024-01-11 11:16 ` Dan Carpenter
2024-01-11 12:55   ` Arnd Bergmann [this message]
2024-01-11 16:37     ` Arnd Bergmann
2024-01-12  2:46       ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=908325ed-08af-4b0c-926e-da9afba25772@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=llvm@lists.linux.dev \
    --cc=naresh.kamboju@linaro.org \
    --cc=regressions@lists.linux.dev \
    --cc=urezki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®