linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
	Pedro Falcato <pedro.falcato@gmail.com>,
	David Hildenbrand <david@redhat.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Jeff Xu <jeffxu@chromium.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mremap: fix uninitialized return code
Date: Wed, 5 Mar 2025 18:34:52 +0000	[thread overview]
Message-ID: <07467d4e-4882-4649-8845-c53cb2cc243c@lucifer.local> (raw)
In-Reply-To: <eda53542-14f2-44fe-aa18-8cd3dfe1ed75@app.fastmail.com>

On Wed, Mar 05, 2025 at 07:25:38PM +0100, Arnd Bergmann wrote:
> On Wed, Mar 5, 2025, at 18:29, Lorenzo Stoakes wrote:
> > On Wed, Mar 05, 2025 at 06:27:56PM +0100, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> The 'err' variable is set in a conditinal branch and is not
> >> set otherwise:
> >>
> >> mm/mremap.c:1017:7: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> >>  1017 |                 if (vma->vm_start != old_addr)
> >>
> >> Set it to zero before the initial value is set.
> >>
> >> Fixes: 3129f7896afb ("mm/mremap: initial refactor of move_vma()")
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >
> > Thanks for this, however this has already been fixed via Andrew doing a
> > fix-patch which should land in mm-unstable,-next soon (possibly tmr?).
> >
> > This is entirely my bad btw, for some reason my compiler locally didn't
> > catch this even with CONFIG_WERROR on which _really_ surprises me...
>
> Unfortunately gcc never shows warnings about conditionally uninitialized
> variables. There is a -Wmaybe-uninitialized, but that has so many
> false positives that it is completely useless and it is turned
> off globally.

OK I notice by building with LLVM=1 this is immediately reported locally,
so from now on I'll make sure to do a clang build too.

At least there is some means by which I can sensibly determine this!

Cheers!

>
>       Arnd


  reply	other threads:[~2025-03-05 18:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 17:27 Arnd Bergmann
2025-03-05 17:29 ` Lorenzo Stoakes
2025-03-05 18:25   ` Arnd Bergmann
2025-03-05 18:34     ` Lorenzo Stoakes [this message]
2025-03-05 18:46 ` Yosry Ahmed

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=07467d4e-4882-4649-8845-c53cb2cc243c@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=david@redhat.com \
    --cc=jannh@google.com \
    --cc=jeffxu@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pedro.falcato@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=wangkefeng.wang@huawei.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