From: SeongJae Park <sj@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: SeongJae Park <sj@kernel.org>,
llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
damon@lists.linux.dev
Subject: Re: [sj:damon/next 156/181] mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false
Date: Mon, 20 Apr 2026 20:56:20 -0700 [thread overview]
Message-ID: <20260421035620.138367-1-sj@kernel.org> (raw)
In-Reply-To: <202604210331.wdB3yt0y-lkp@intel.com>
On Tue, 21 Apr 2026 03:16:29 +0800 kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/sj/linux.git damon/next
> head: ecd4906478687820c088904becbcf3c80ded7d81
> commit: 8c863600a03e3066ce88bf8db48953176befa4c4 [156/181] mm/damon/paddr: do data_attr filtering
> config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20260421/202604210331.wdB3yt0y-lkp@intel.com/config)
> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260421/202604210331.wdB3yt0y-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202604210331.wdB3yt0y-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> 195 | if (f->type == DAMON_FILTER_TYPE_ANON) {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/damon/paddr.c:203:7: note: uninitialized use occurs here
> 203 | if (matched)
> | ^~~~~~~
> mm/damon/paddr.c:195:3: note: remove the 'if' if its condition is always true
> 195 | if (f->type == DAMON_FILTER_TYPE_ANON) {
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/damon/paddr.c:193:15: note: initialize the variable 'matched' to silence this warning
> 193 | bool matched;
> | ^
> | = 0
> 1 warning generated.
Thank you for this report! I just pushed below as a fix to damon/next.
'''
Author: SeongJae Park <sj@kernel.org>
Date: Mon Apr 20 20:52:35 2026 -0700
mm/damon/paddr: initialize 'matched' in damon_pa_tests_pass()
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202604210331.wdB3yt0y-lkp@intel.com/
Signed-off-by: SeongJae Park <sj@kernel.org>
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 4788abce08a50..8d49c3e944cfe 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -190,14 +190,12 @@ static bool damon_pa_tests_pass(phys_addr_t pa, struct damon_counter *c)
bool default_pass = true;
damon_for_each_test(t, c) {
- bool matched;
+ bool matched = false;
if (t->type == DAMON_TEST_TYPE_ANON) {
struct folio *folio = damon_get_folio(PHYS_PFN(pa));
- if (!folio)
- matched = false;
- else
+ if (folio)
matched = folio_test_anon(folio);
}
if (matched)
'''
Thanks,
SJ
[...]
prev parent reply other threads:[~2026-04-21 3:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 19:16 [sj:damon/next 156/181] mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false kernel test robot
2026-04-21 3:56 ` SeongJae Park [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=20260421035620.138367-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.