All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Zach Brown <zab@zabbo.net>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [zab-rpdfs:rpdfs-initial 83/98] fs/rpdfs/ehtable.c:259:2: warning: variable 'del' is used uninitialized whenever 'for' loop exits because its condition is false
Date: Sat, 24 Oct 2026 02:19:54 +0200	[thread overview]
Message-ID: <202610240228.NDsWRPuI-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/zab/linux-rpdfs.git rpdfs-initial
head:   8a293e5c1bf0416f4d4e116bf8693c00dbe876da
commit: 2658c3c902752b51b9bebb9bb36cf7dcde32d28d [83/98] rpdfs: add meta code for caching metadata
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20261024/202610240228.NDsWRPuI-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261024/202610240228.NDsWRPuI-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/202610240228.NDsWRPuI-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from <built-in>:3:
   In file included from include/linux/compiler_types.h:171:
   include/linux/compiler-clang.h:28:9: warning: '__SANITIZE_ADDRESS__' macro redefined [-Wmacro-redefined]
      28 | #define __SANITIZE_ADDRESS__
         |         ^
   <built-in>:372:9: note: previous definition is here
     372 | #define __SANITIZE_ADDRESS__ 1
         |         ^
   In file included from fs/rpdfs/ehtable.c:9:
   fs/rpdfs/meta.h:8:43: warning: declaration of 'struct rpdfs_iget_data' will not be visible outside of this function [-Wvisibility]
       8 | int rpdfs_folio_loc_from_block_key(struct rpdfs_iget_data *igd, pgoff_t *index,
         |                                           ^
>> fs/rpdfs/ehtable.c:259:2: warning: variable 'del' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
     259 |         for_each_entry(ehb, iargs->hash, ent, pl) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/rpdfs/ehtable.c:148:2: note: expanded from macro 'for_each_entry'
     148 |         __for_each_entry(ehb, base_entry(ehb, hash), ent, pl)
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/rpdfs/ehtable.c:144:7: note: expanded from macro '__for_each_entry'
     144 |              (ent = &ehb->entries[(ent - ehb->entries) & RPDFS_EHTABLE_ENTRIES_MASK]); \
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/rpdfs/ehtable.c:275:31: note: uninitialized use occurs here
     275 |         for_each_entry_continue(ehb, del, ent, pl) {
         |                                      ^~~
   fs/rpdfs/ehtable.c:259:2: note: remove the condition if it is always true
     259 |         for_each_entry(ehb, iargs->hash, ent, pl) {
         |         ^
   fs/rpdfs/ehtable.c:148:2: note: expanded from macro 'for_each_entry'
     148 |         __for_each_entry(ehb, base_entry(ehb, hash), ent, pl)
         |         ^
   fs/rpdfs/ehtable.c:144:7: note: expanded from macro '__for_each_entry'
     144 |              (ent = &ehb->entries[(ent - ehb->entries) & RPDFS_EHTABLE_ENTRIES_MASK]); \
         |              ^
   fs/rpdfs/ehtable.c:254:33: note: initialize the variable 'del' to silence this warning
     254 |         struct rpdfs_ehtable_entry *del;
         |                                        ^
         |                                         = NULL
   3 warnings generated.


vim +259 fs/rpdfs/ehtable.c

bc6c59466912ed0 Zach Brown 2026-07-09  243  
bc6c59466912ed0 Zach Brown 2026-07-09  244  /*
bc6c59466912ed0 Zach Brown 2026-07-09  245   * Find and delete an entry that matches the key.  Returns errors if no
bc6c59466912ed0 Zach Brown 2026-07-09  246   * key was found or gives the caller the offset of the item whose entry
bc6c59466912ed0 Zach Brown 2026-07-09  247   * was removed.
bc6c59466912ed0 Zach Brown 2026-07-09  248   */
bc6c59466912ed0 Zach Brown 2026-07-09  249  static int delete_entry(struct rpdfs_ehtable_block *ehb, struct rpdfs_ehtable_item_args *iargs,
bc6c59466912ed0 Zach Brown 2026-07-09  250  			u16 *offset)
bc6c59466912ed0 Zach Brown 2026-07-09  251  {
bc6c59466912ed0 Zach Brown 2026-07-09  252  	struct rpdfs_ehtable_item *item;
bc6c59466912ed0 Zach Brown 2026-07-09  253  	struct rpdfs_ehtable_entry *ent;
bc6c59466912ed0 Zach Brown 2026-07-09  254  	struct rpdfs_ehtable_entry *del;
bc6c59466912ed0 Zach Brown 2026-07-09  255  	u8 pl;
bc6c59466912ed0 Zach Brown 2026-07-09  256  	int ret;
bc6c59466912ed0 Zach Brown 2026-07-09  257  
bc6c59466912ed0 Zach Brown 2026-07-09  258  	/* search for the entry to delete, setting offset */
bc6c59466912ed0 Zach Brown 2026-07-09 @259  	for_each_entry(ehb, iargs->hash, ent, pl) {
bc6c59466912ed0 Zach Brown 2026-07-09  260  		if (ent_is_empty(ent) || pl > ent->probe_len) {
bc6c59466912ed0 Zach Brown 2026-07-09  261  			ret = -ENOENT;
bc6c59466912ed0 Zach Brown 2026-07-09  262  			goto out;
bc6c59466912ed0 Zach Brown 2026-07-09  263  		}
bc6c59466912ed0 Zach Brown 2026-07-09  264  
bc6c59466912ed0 Zach Brown 2026-07-09  265  		item = ent_item(ehb, ent);
bc6c59466912ed0 Zach Brown 2026-07-09  266  		if (keys_match(le32_to_cpu(ent->hash), item_key(item), get_key_size(item),
bc6c59466912ed0 Zach Brown 2026-07-09  267  			       iargs->hash, iargs->key, iargs->key_size)) {
bc6c59466912ed0 Zach Brown 2026-07-09  268  			*offset = le16_to_cpu(ent->offset);
bc6c59466912ed0 Zach Brown 2026-07-09  269  			del = ent;
bc6c59466912ed0 Zach Brown 2026-07-09  270  			break;
bc6c59466912ed0 Zach Brown 2026-07-09  271  		}
bc6c59466912ed0 Zach Brown 2026-07-09  272  	}
bc6c59466912ed0 Zach Brown 2026-07-09  273  
bc6c59466912ed0 Zach Brown 2026-07-09  274  	/* move later entries with nonzero probe length back to fill the gap, finally clearing */
bc6c59466912ed0 Zach Brown 2026-07-09  275  	for_each_entry_continue(ehb, del, ent, pl) {
bc6c59466912ed0 Zach Brown 2026-07-09  276  		if (ent_is_empty(ent) || ent->probe_len == 0) {
bc6c59466912ed0 Zach Brown 2026-07-09  277  			memset(del, 0, sizeof(struct rpdfs_ehtable_entry));
bc6c59466912ed0 Zach Brown 2026-07-09  278  			break;
bc6c59466912ed0 Zach Brown 2026-07-09  279  		}
bc6c59466912ed0 Zach Brown 2026-07-09  280  
bc6c59466912ed0 Zach Brown 2026-07-09  281  		*del = *ent;
bc6c59466912ed0 Zach Brown 2026-07-09  282  		del->probe_len--;
bc6c59466912ed0 Zach Brown 2026-07-09  283  		del = ent;
bc6c59466912ed0 Zach Brown 2026-07-09  284  	}
bc6c59466912ed0 Zach Brown 2026-07-09  285  
bc6c59466912ed0 Zach Brown 2026-07-09  286  	ret = 0;
bc6c59466912ed0 Zach Brown 2026-07-09  287  out:
bc6c59466912ed0 Zach Brown 2026-07-09  288  	return ret;
bc6c59466912ed0 Zach Brown 2026-07-09  289  }
bc6c59466912ed0 Zach Brown 2026-07-09  290  

:::::: The code at line 259 was first introduced by commit
:::::: bc6c59466912ed0c3e69c4283a40e05484ed517c rpdfs: add ehtable for indexing key-value pairs

:::::: TO: Zach Brown <zab@zabbo.net>
:::::: CC: Zach Brown <zab@zabbo.net>

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

                 reply	other threads:[~2026-10-24  0:20 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=202610240228.NDsWRPuI-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=zab@zabbo.net \
    /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.