* [sj:damon/next 156/181] mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false
@ 2026-04-20 19:16 kernel test robot
2026-04-21 3:56 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-04-20 19:16 UTC (permalink / raw)
To: SeongJae Park; +Cc: llvm, oe-kbuild-all
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.
vim +195 mm/damon/paddr.c
186
187 static bool damon_pa_is_attr(phys_addr_t pa, struct damon_data_attr *a)
188 {
189 struct damon_filter *f;
190 bool default_allow = true;
191
192 damon_for_each_filter(f, a) {
193 bool matched;
194
> 195 if (f->type == DAMON_FILTER_TYPE_ANON) {
196 struct folio *folio = damon_get_folio(PHYS_PFN(pa));
197
198 if (!folio)
199 matched = false;
200 else
201 matched = folio_test_anon(folio);
202 }
203 if (matched)
204 return f->allow;
205 default_allow = !f->allow;
206 }
207 return default_allow;
208 }
209
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [sj:damon/next 156/181] mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false
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
0 siblings, 0 replies; 2+ messages 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] 2+ messages in thread
end of thread, other threads:[~2026-04-21 3:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox