From: Andrew Morton <akpm@linux-foundation.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: oe-kbuild@lists.linux.dev, Yu Zhao <yuzhao@google.com>,
lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: mm/vmscan.c:3504 walk_pte_range() error: uninitialized symbol 'dirty'.
Date: Tue, 27 May 2025 17:03:49 -0700 [thread overview]
Message-ID: <20250527170349.4eb72b40e4c6e2a6c1c6bce6@linux-foundation.org> (raw)
In-Reply-To: <aDRfak8sX1Pf53Pg@stanley.mountain>
On Mon, 26 May 2025 15:32:42 +0300 Dan Carpenter <dan.carpenter@linaro.org> wrote:
> > Seems to be notabug because last==NULL on the first loop and in this
> > case walk_update_folio() will immediately return without touching
> > `dirty'. But gee, I can't blame smatch from getting fooled by this.
>
> That's true, but if walk_update_folio() we not inlined then we would
> still consider this a bug. It's undefined behavior in the C standard
> to pass uninitialized variables to a function call and also the UBSan
> checker will detected it as a read at runtime.
>
> In production systems the compiler is going to set
> "bool dirty = false;" at the start of the function because everyone
> runs with CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y. Should I send a patch
> which does that explicitly?
Yes please. And please include some sort of comment to prevent people
from optimizing away the fix ;)
prev parent reply other threads:[~2025-05-28 0:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 10:47 Dan Carpenter
2025-05-23 22:27 ` Andrew Morton
2025-05-26 12:32 ` Dan Carpenter
2025-05-28 0:03 ` Andrew Morton [this message]
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=20250527170349.4eb72b40e4c6e2a6c1c6bce6@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=yuzhao@google.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