* fs/btrfs/props.c:147:25: sparse: sparse: Variable length array is used.
@ 2026-07-16 8:59 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-16 8:59 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-16 9:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16 8:59 fs/btrfs/props.c:147:25: sparse: sparse: Variable length array is used kernel test robot
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.