All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jan Kara <jack@suse.cz>
Cc: oe-kbuild-all@lists.linux.dev
Subject: fs/quota/quota_tree.c:674:8: warning: variable 'blk' is uninitialized when used here
Date: Sat, 10 Feb 2024 14:01:32 +0800	[thread overview]
Message-ID: <202402101306.SBcbZx79-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
head:   71b12545f603de39a967b52287c29ede3f85ff2f
commit: 223bfb57631b10036e55579ecb5718123fa41c8c quota: Detect loops in quota tree
date:   19 hours ago
config: i386-randconfig-141-20240210 (https://download.01.org/0day-ci/archive/20240210/202402101306.SBcbZx79-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240210/202402101306.SBcbZx79-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/202402101306.SBcbZx79-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/quota/quota_tree.c:674:8: warning: variable 'blk' is uninitialized when used here [-Wuninitialized]
     674 |                             blk);
         |                             ^~~
   include/linux/quotaops.h:34:41: note: expanded from macro 'quota_error'
      34 |         __quota_error((sb), __func__, fmt , ## args)
         |                                                ^~~~
   fs/quota/quota_tree.c:666:10: note: initialize the variable 'blk' to silence this warning
     666 |         uint blk;
         |                 ^
         |                  = 0
   1 warning generated.


vim +/blk +674 fs/quota/quota_tree.c

1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  658  
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  659  /* Find entry for given id in the tree */
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  660  static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  661  				struct dquot *dquot, uint *blks, int depth)
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  662  {
a1e1b2becab7c0 fs/quota/quota_tree.c Jan Kara      2024-01-22  663  	char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL);
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  664  	loff_t ret = 0;
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  665  	__le32 *ref = (__le32 *)buf;
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  666  	uint blk;
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  667  	int i;
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  668  
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  669  	if (!buf)
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  670  		return -ENOMEM;
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  671  	ret = read_blk(info, blks[depth], buf);
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  672  	if (ret < 0) {
fb5ffb0e160c93 fs/quota/quota_tree.c Jiaying Zhang 2010-07-20  673  		quota_error(dquot->dq_sb, "Can't read quota tree block %u",
fb5ffb0e160c93 fs/quota/quota_tree.c Jiaying Zhang 2010-07-20 @674  			    blk);
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  675  		goto out_buf;
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  676  	}
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  677  	ret = 0;
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  678  	blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  679  	if (!blk)	/* No reference? */
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  680  		goto out_buf;
3fc61e0e96a326 fs/quota/quota_tree.c Zhihao Cheng  2022-09-23  681  	ret = do_check_range(dquot->dq_sb, "block", blk, QT_TREEOFF,
3fc61e0e96a326 fs/quota/quota_tree.c Zhihao Cheng  2022-09-23  682  			     info->dqi_blocks - 1);
3fc61e0e96a326 fs/quota/quota_tree.c Zhihao Cheng  2022-09-23  683  	if (ret)
9bf3d20331295b fs/quota/quota_tree.c Zhang Yi      2021-10-08  684  		goto out_buf;
9bf3d20331295b fs/quota/quota_tree.c Zhang Yi      2021-10-08  685  
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  686  	/* Check for cycles in the tree */
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  687  	for (i = 0; i <= depth; i++)
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  688  		if (blk == blks[i]) {
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  689  			quota_error(dquot->dq_sb,
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  690  				"Cycle in quota tree detected: block %u index %u",
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  691  				blks[depth],
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  692  				get_index(info, dquot->dq_id, depth));
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  693  			ret = -EIO;
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  694  			goto out_buf;
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  695  		}
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  696  	blks[depth + 1] = blk;
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  697  	if (depth < info->dqi_qtree_depth - 1)
223bfb57631b10 fs/quota/quota_tree.c Jan Kara      2024-02-07  698  		ret = find_tree_dqentry(info, dquot, blks, depth + 1);
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  699  	else
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  700  		ret = find_block_dqentry(info, dquot, blk);
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  701  out_buf:
d26ac1a8128f6e fs/quota/quota_tree.c Jan Kara      2009-01-26  702  	kfree(buf);
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  703  	return ret;
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  704  }
1ccd14b9c271c1 fs/quota_tree.c       Jan Kara      2008-09-22  705  

:::::: The code at line 674 was first introduced by commit
:::::: fb5ffb0e160c93c3fe08ab83845eb9a2768af812 quota: Change quota error message to print out disk and function name

:::::: TO: Jiaying Zhang <jiayingz@google.com>
:::::: CC: Jan Kara <jack@suse.cz>

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

             reply	other threads:[~2024-02-10  6:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-10  6:01 kernel test robot [this message]
2024-02-12 13:16 ` fs/quota/quota_tree.c:674:8: warning: variable 'blk' is uninitialized when used here Jan Kara

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=202402101306.SBcbZx79-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jack@suse.cz \
    --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 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.