Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [koverstreet-bcachefs:bcachefs-testing 303/318] fs/bcachefs/backpointers.c:695:8: warning: variable 'empty' is used uninitialized whenever 'if' condition is true
Date: Wed, 28 May 2025 09:47:29 +0800	[thread overview]
Message-ID: <202505280902.IdRcM2ys-lkp@intel.com> (raw)

tree:   https://github.com/koverstreet/bcachefs bcachefs-testing
head:   ad02d8684ab62f039bcf56a848b55c01bde6c4fd
commit: a47a765c7d5f490c96377bd09362faa6a9e8c213 [303/318] bcachefs: Replace rcu_read_lock() with guards
config: x86_64-buildonly-randconfig-002-20250528 (https://download.01.org/0day-ci/archive/20250528/202505280902.IdRcM2ys-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
rustc: rustc 1.78.0 (9b00956e5 2024-04-29)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250528/202505280902.IdRcM2ys-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/202505280902.IdRcM2ys-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/bcachefs/backpointers.c:695:8: warning: variable 'empty' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     695 |                         if (!bch2_bucket_bitmap_test(&ca->bucket_backpointer_mismatch, b))
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/bcachefs/backpointers.c:704:14: note: uninitialized use occurs here
     704 |                 int ret = !empty
         |                            ^~~~~
   fs/bcachefs/backpointers.c:695:4: note: remove the 'if' if its condition is always false
     695 |                         if (!bch2_bucket_bitmap_test(&ca->bucket_backpointer_mismatch, b))
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     696 |                                 continue;
         |                                 ~~~~~~~~
   fs/bcachefs/backpointers.c:691:8: warning: variable 'empty' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     691 |                         if (p.ptr.cached && dev_ptr_stale_rcu(ca, &p.ptr))
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/bcachefs/backpointers.c:704:14: note: uninitialized use occurs here
     704 |                 int ret = !empty
         |                            ^~~~~
   fs/bcachefs/backpointers.c:691:4: note: remove the 'if' if its condition is always false
     691 |                         if (p.ptr.cached && dev_ptr_stale_rcu(ca, &p.ptr))
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     692 |                                 continue;
         |                                 ~~~~~~~~
   fs/bcachefs/backpointers.c:688:8: warning: variable 'empty' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     688 |                         if (!ca)
         |                             ^~~
   fs/bcachefs/backpointers.c:704:14: note: uninitialized use occurs here
     704 |                 int ret = !empty
         |                            ^~~~~
   fs/bcachefs/backpointers.c:688:4: note: remove the 'if' if its condition is always false
     688 |                         if (!ca)
         |                         ^~~~~~~~
     689 |                                 continue;
         |                                 ~~~~~~~~
   fs/bcachefs/backpointers.c:685:13: note: initialize the variable 'empty' to silence this warning
     685 |                 bool empty;
         |                           ^
         |                            = 0
   3 warnings generated.


vim +695 fs/bcachefs/backpointers.c

   670	
   671	static int check_extent_to_backpointers(struct btree_trans *trans,
   672						struct extents_to_bp_state *s,
   673						enum btree_id btree, unsigned level,
   674						struct bkey_s_c k)
   675	{
   676		struct bch_fs *c = trans->c;
   677		struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
   678		const union bch_extent_entry *entry;
   679		struct extent_ptr_decoded p;
   680	
   681		bkey_for_each_ptr_decode(k.k, ptrs, p, entry) {
   682			if (p.ptr.dev == BCH_SB_MEMBER_INVALID)
   683				continue;
   684	
   685			bool empty;
   686			scoped_guard(rcu) {
   687				struct bch_dev *ca = bch2_dev_rcu_noerror(c, p.ptr.dev);
   688				if (!ca)
   689					continue;
   690	
   691				if (p.ptr.cached && dev_ptr_stale_rcu(ca, &p.ptr))
   692					continue;
   693	
   694				u64 b = PTR_BUCKET_NR(ca, &p.ptr);
 > 695				if (!bch2_bucket_bitmap_test(&ca->bucket_backpointer_mismatch, b))
   696					continue;
   697	
   698				empty = bch2_bucket_bitmap_test(&ca->bucket_backpointer_empty, b);
   699			}
   700	
   701			struct bkey_i_backpointer bp;
   702			bch2_extent_ptr_to_bp(c, btree, level, k, p, entry, &bp);
   703	
   704			int ret = !empty
   705				? check_bp_exists(trans, s, &bp, k)
   706				: bch2_bucket_backpointer_mod(trans, k, &bp, true);
   707			if (ret)
   708				return ret;
   709		}
   710	
   711		return 0;
   712	}
   713	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2025-05-28  1:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202505280902.IdRcM2ys-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kent.overstreet@linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox