* Re: [sj:damon/next 156/181] mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false
[not found] <202604210331.wdB3yt0y-lkp@intel.com>
@ 2026-04-21 3:56 ` SeongJae Park
0 siblings, 0 replies; only message in thread
From: SeongJae Park @ 2026-04-21 3:56 UTC (permalink / raw)
To: kernel test robot; +Cc: SeongJae Park, llvm, oe-kbuild-all, damon
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
[...]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-21 3:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <202604210331.wdB3yt0y-lkp@intel.com>
2026-04-21 3:56 ` [sj:damon/next 156/181] mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox