All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: SeongJae Park <sj@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [sj:damon/next 156/181] mm/damon/paddr.c:195:7: warning: variable 'matched' is used uninitialized whenever 'if' condition is false
Date: Tue, 21 Apr 2026 03:16:29 +0800	[thread overview]
Message-ID: <202604210331.wdB3yt0y-lkp@intel.com> (raw)

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

             reply	other threads:[~2026-04-20 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 19:16 kernel test robot [this message]
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

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=202604210331.wdB3yt0y-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sj@kernel.org \
    /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.