fs/btrfs/props.c:147:25: sparse: sparse: Variable length array is used.
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild |
|---|---|
| Message-ID | <[email protected]> |
:::::: :::::: Manual check reason: "low confidence static check warning: fs/btrfs/props.c:147:25: sparse: sparse: Variable length array is used." :::::: BCC: [email protected] CC: [email protected] CC: [email protected] TO: Filipe Manana <[email protected]> CC: David Sterba <[email protected]> CC: Qu Wenruo <[email protected]> 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/[email protected]/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/[email protected]/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 <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/ 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