0 day kernel build service
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: fs/btrfs/props.c:147:25: sparse: sparse: Variable length array is used.
Date: Thu, 16 Jul 2026 16:59:56 +0800	[thread overview]
Message-ID: <202607161648.fAurQlez-lkp@intel.com> (raw)

:::::: 
:::::: Manual check reason: "low confidence static check warning: fs/btrfs/props.c:147:25: sparse: sparse: Variable length array is used."
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Filipe Manana <fdmanana@suse.com>
CC: David Sterba <dsterba@suse.com>
CC: Qu Wenruo <wqu@suse.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58717b2a1365d06c8c64b72aa948541b53fe31eb
commit: cf1afec09e9f004a62c54c471863209ed249fca7 btrfs: validate properties before setting them
date:   2 weeks ago
:::::: branch date: 2 days ago
:::::: commit date: 2 weeks ago
config: sparc64-randconfig-r121-20260716 (https://download.01.org/0day-ci/archive/20260716/202607161648.fAurQlez-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 10.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260716/202607161648.fAurQlez-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
| Fixes: cf1afec09e9f ("btrfs: validate properties before setting them")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202607161648.fAurQlez-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/btrfs/props.c:147:25: sparse: sparse: Variable length array is used.

vim +147 fs/btrfs/props.c

4b73c55fdebd89 Filipe Manana             2022-04-21  106  
0d9b7e166aef9f David Sterba              2022-01-31  107  int btrfs_set_prop(struct btrfs_trans_handle *trans, struct btrfs_inode *inode,
7715da84f74d5d Anand Jain                2019-03-01  108  		   const char *name, const char *value, size_t value_len,
63541927c8d11d Filipe David Borba Manana 2014-01-07  109  		   int flags)
63541927c8d11d Filipe David Borba Manana 2014-01-07  110  {
63541927c8d11d Filipe David Borba Manana 2014-01-07  111  	const struct prop_handler *handler;
63541927c8d11d Filipe David Borba Manana 2014-01-07  112  	int ret;
63541927c8d11d Filipe David Borba Manana 2014-01-07  113  
63541927c8d11d Filipe David Borba Manana 2014-01-07  114  	handler = find_prop_handler(name, NULL);
63541927c8d11d Filipe David Borba Manana 2014-01-07  115  	if (!handler)
63541927c8d11d Filipe David Borba Manana 2014-01-07  116  		return -EINVAL;
63541927c8d11d Filipe David Borba Manana 2014-01-07  117  
63541927c8d11d Filipe David Borba Manana 2014-01-07  118  	if (value_len == 0) {
0d9b7e166aef9f David Sterba              2022-01-31  119  		ret = btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name,
63541927c8d11d Filipe David Borba Manana 2014-01-07  120  				     NULL, 0, flags);
63541927c8d11d Filipe David Borba Manana 2014-01-07  121  		if (ret)
63541927c8d11d Filipe David Borba Manana 2014-01-07  122  			return ret;
63541927c8d11d Filipe David Borba Manana 2014-01-07  123  
7e027b767deb4a David Sterba              2025-02-18  124  		ret = handler->apply(inode, NULL, 0);
63541927c8d11d Filipe David Borba Manana 2014-01-07  125  		ASSERT(ret == 0);
63541927c8d11d Filipe David Borba Manana 2014-01-07  126  
63541927c8d11d Filipe David Borba Manana 2014-01-07  127  		return ret;
63541927c8d11d Filipe David Borba Manana 2014-01-07  128  	}
63541927c8d11d Filipe David Borba Manana 2014-01-07  129  
cf1afec09e9f00 Filipe Manana             2026-06-08  130  	ret = handler->validate(inode, value, value_len);
cf1afec09e9f00 Filipe Manana             2026-06-08  131  	if (ret)
cf1afec09e9f00 Filipe Manana             2026-06-08  132  		return ret;
0d9b7e166aef9f David Sterba              2022-01-31  133  	ret = btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name, value,
04e6863b19c722 Anand Jain                2019-04-12  134  			     value_len, flags);
63541927c8d11d Filipe David Borba Manana 2014-01-07  135  	if (ret)
63541927c8d11d Filipe David Borba Manana 2014-01-07  136  		return ret;
7e027b767deb4a David Sterba              2025-02-18  137  	ret = handler->apply(inode, value, value_len);
cf1afec09e9f00 Filipe Manana             2026-06-08  138  	/* We validated before, so it should not fail here. */
cf1afec09e9f00 Filipe Manana             2026-06-08  139  	ASSERT(ret == 0);
cf1afec09e9f00 Filipe Manana             2026-06-08  140  	if (unlikely(ret)) {
cf1afec09e9f00 Filipe Manana             2026-06-08  141  		int ret2;
cf1afec09e9f00 Filipe Manana             2026-06-08  142  
cf1afec09e9f00 Filipe Manana             2026-06-08  143  		/* Try to delete xattr, if not possible abort transaction. */
cf1afec09e9f00 Filipe Manana             2026-06-08  144  		ret2 = btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name,
cf1afec09e9f00 Filipe Manana             2026-06-08  145  				      NULL, 0, flags);
cf1afec09e9f00 Filipe Manana             2026-06-08  146  		if (unlikely(ret2))
cf1afec09e9f00 Filipe Manana             2026-06-08 @147  			btrfs_abort_transaction(trans, ret2);
63541927c8d11d Filipe David Borba Manana 2014-01-07  148  		return ret;
63541927c8d11d Filipe David Borba Manana 2014-01-07  149  	}
63541927c8d11d Filipe David Borba Manana 2014-01-07  150  
0d9b7e166aef9f David Sterba              2022-01-31  151  	set_bit(BTRFS_INODE_HAS_PROPS, &inode->runtime_flags);
63541927c8d11d Filipe David Borba Manana 2014-01-07  152  
63541927c8d11d Filipe David Borba Manana 2014-01-07  153  	return 0;
63541927c8d11d Filipe David Borba Manana 2014-01-07  154  }
63541927c8d11d Filipe David Borba Manana 2014-01-07  155  

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

                 reply	other threads:[~2026-07-16  9:00 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=202607161648.fAurQlez-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@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