[allisonhenderson-xfs_work:delayed_attrs_v22_extended 29/32] fs/xfs/xfs_inode.c:3526 xfs_rename() error: uninitialized symbol 'new_diroffset'.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Allison Henderson <allison.henderson(a)oracle.com>
CC: Mark Tinguely <tinguely(a)sgi.com>
CC: Dave Chinner <dchinner(a)redhat.com>
CC: "Darrick J. Wong" <darrick.wong(a)oracle.com>
tree: https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v22_extended
head: aff89515c2d9aca9b24ac0296f3806af62cd9206
commit: 7ea04e9ca4238354c031a0ee00b8b5215c15ea01 [29/32] xfs: Add the parent pointer support to the superblock version 5.
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: microblaze-randconfig-m031-20210730 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 10.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
fs/xfs/xfs_inode.c:3526 xfs_rename() error: uninitialized symbol 'new_diroffset'.
fs/xfs/xfs_inode.c:3534 xfs_rename() error: uninitialized symbol 'old_diroffset'.
Old smatch warnings:
arch/microblaze/include/asm/thread_info.h:91 current_thread_info() error: uninitialized symbol 'sp'.
vim +/new_diroffset +3526 fs/xfs/xfs_inode.c
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3155
f6bba2017afb3bd Dave Chinner 2013-08-12 3156 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3157 * xfs_rename
f6bba2017afb3bd Dave Chinner 2013-08-12 3158 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3159 int
f6bba2017afb3bd Dave Chinner 2013-08-12 3160 xfs_rename(
f736d93d76d3e97 Christoph Hellwig 2021-01-21 3161 struct user_namespace *mnt_userns,
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3162 struct xfs_inode *src_dp,
f6bba2017afb3bd Dave Chinner 2013-08-12 3163 struct xfs_name *src_name,
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3164 struct xfs_inode *src_ip,
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3165 struct xfs_inode *target_dp,
f6bba2017afb3bd Dave Chinner 2013-08-12 3166 struct xfs_name *target_name,
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3167 struct xfs_inode *target_ip,
d31a1825450062b Carlos Maiolino 2014-12-24 3168 unsigned int flags)
f6bba2017afb3bd Dave Chinner 2013-08-12 3169 {
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3170 struct xfs_mount *mp = src_dp->i_mount;
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3171 struct xfs_trans *tp;
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3172 struct xfs_inode *wip = NULL; /* whiteout inode */
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3173 struct xfs_inode *inodes[__XFS_SORT_INODES];
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3174 int i;
95afcf5c7bca93f Dave Chinner 2015-03-25 3175 int num_inodes = __XFS_SORT_INODES;
2b93681f593577d Dave Chinner 2015-03-25 3176 bool new_parent = (src_dp != target_dp);
c19b3b05ae440de Dave Chinner 2016-02-09 3177 bool src_is_directory = S_ISDIR(VFS_I(src_ip)->i_mode);
f6bba2017afb3bd Dave Chinner 2013-08-12 3178 int spaceres;
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3179 int error;
3818584f03ce2d5 Allison Henderson 2021-03-24 3180 struct xfs_parent_name_rec new_rec;
3818584f03ce2d5 Allison Henderson 2021-03-24 3181 struct xfs_parent_name_rec old_rec;
3818584f03ce2d5 Allison Henderson 2021-03-24 3182 xfs_dir2_dataptr_t new_diroffset;
3818584f03ce2d5 Allison Henderson 2021-03-24 3183 xfs_dir2_dataptr_t old_diroffset;
3818584f03ce2d5 Allison Henderson 2021-03-24 3184 struct xfs_da_args new_args = {
3818584f03ce2d5 Allison Henderson 2021-03-24 3185 .dp = src_ip,
3818584f03ce2d5 Allison Henderson 2021-03-24 3186 .geo = mp->m_attr_geo,
3818584f03ce2d5 Allison Henderson 2021-03-24 3187 .whichfork = XFS_ATTR_FORK,
3818584f03ce2d5 Allison Henderson 2021-03-24 3188 .attr_filter = XFS_ATTR_PARENT,
3818584f03ce2d5 Allison Henderson 2021-03-24 3189 .op_flags = XFS_DA_OP_OKNOENT,
3818584f03ce2d5 Allison Henderson 2021-03-24 3190 .name = (const uint8_t *)&new_rec,
3818584f03ce2d5 Allison Henderson 2021-03-24 3191 .namelen = sizeof(new_rec),
3818584f03ce2d5 Allison Henderson 2021-03-24 3192 .value = (void *)target_name->name,
3818584f03ce2d5 Allison Henderson 2021-03-24 3193 .valuelen = target_name->len,
3818584f03ce2d5 Allison Henderson 2021-03-24 3194 };
3818584f03ce2d5 Allison Henderson 2021-03-24 3195 struct xfs_da_args old_args = {
3818584f03ce2d5 Allison Henderson 2021-03-24 3196 .dp = src_ip,
3818584f03ce2d5 Allison Henderson 2021-03-24 3197 .geo = mp->m_attr_geo,
3818584f03ce2d5 Allison Henderson 2021-03-24 3198 .whichfork = XFS_ATTR_FORK,
3818584f03ce2d5 Allison Henderson 2021-03-24 3199 .attr_filter = XFS_ATTR_PARENT,
3818584f03ce2d5 Allison Henderson 2021-03-24 3200 .op_flags = XFS_DA_OP_OKNOENT,
3818584f03ce2d5 Allison Henderson 2021-03-24 3201 .name = (const uint8_t *)&old_rec,
3818584f03ce2d5 Allison Henderson 2021-03-24 3202 .namelen = sizeof(old_rec),
3818584f03ce2d5 Allison Henderson 2021-03-24 3203 .value = NULL,
3818584f03ce2d5 Allison Henderson 2021-03-24 3204 .valuelen = 0,
3818584f03ce2d5 Allison Henderson 2021-03-24 3205 };
f6bba2017afb3bd Dave Chinner 2013-08-12 3206
f6bba2017afb3bd Dave Chinner 2013-08-12 3207 trace_xfs_rename(src_dp, target_dp, src_name, target_name);
f6bba2017afb3bd Dave Chinner 2013-08-12 3208
eeacd3217b8fa81 Dave Chinner 2015-03-25 3209 if ((flags & RENAME_EXCHANGE) && !target_ip)
eeacd3217b8fa81 Dave Chinner 2015-03-25 3210 return -EINVAL;
eeacd3217b8fa81 Dave Chinner 2015-03-25 3211
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3212 /*
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3213 * If we are doing a whiteout operation, allocate the whiteout inode
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3214 * we will be placing at the target and ensure the type is set
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3215 * appropriately.
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3216 */
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3217 if (flags & RENAME_WHITEOUT) {
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3218 ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
f736d93d76d3e97 Christoph Hellwig 2021-01-21 3219 error = xfs_rename_alloc_whiteout(mnt_userns, target_dp, &wip);
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3220 if (error)
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3221 return error;
f6bba2017afb3bd Dave Chinner 2013-08-12 3222
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3223 /* setup target dirent info as whiteout */
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3224 src_name->type = XFS_DIR3_FT_CHRDEV;
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3225 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3226
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3227 xfs_sort_for_rename(src_dp, target_dp, src_ip, target_ip, wip,
f6bba2017afb3bd Dave Chinner 2013-08-12 3228 inodes, &num_inodes);
3818584f03ce2d5 Allison Henderson 2021-03-24 3229 if (xfs_hasdelattr(mp)) {
3818584f03ce2d5 Allison Henderson 2021-03-24 3230 error = xfs_attr_use_log_assist(mp);
3818584f03ce2d5 Allison Henderson 2021-03-24 3231 if (error)
3818584f03ce2d5 Allison Henderson 2021-03-24 3232 goto out_release_wip;
3818584f03ce2d5 Allison Henderson 2021-03-24 3233 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3234
f6bba2017afb3bd Dave Chinner 2013-08-12 3235 spaceres = XFS_RENAME_SPACE_RES(mp, target_name->len);
253f4911f297b83 Christoph Hellwig 2016-04-06 3236 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_rename, spaceres, 0, 0, &tp);
2451337dd043901 Dave Chinner 2014-06-25 3237 if (error == -ENOSPC) {
f6bba2017afb3bd Dave Chinner 2013-08-12 3238 spaceres = 0;
253f4911f297b83 Christoph Hellwig 2016-04-06 3239 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_rename, 0, 0, 0,
253f4911f297b83 Christoph Hellwig 2016-04-06 3240 &tp);
f6bba2017afb3bd Dave Chinner 2013-08-12 3241 }
445883e8133975f Dave Chinner 2015-03-25 3242 if (error)
3818584f03ce2d5 Allison Henderson 2021-03-24 3243 goto drop_incompat;
f6bba2017afb3bd Dave Chinner 2013-08-12 3244
f6bba2017afb3bd Dave Chinner 2013-08-12 3245 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3246 * Attach the dquots to the inodes
f6bba2017afb3bd Dave Chinner 2013-08-12 3247 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3248 error = xfs_qm_vop_rename_dqattach(inodes);
445883e8133975f Dave Chinner 2015-03-25 3249 if (error)
445883e8133975f Dave Chinner 2015-03-25 3250 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3251
f6bba2017afb3bd Dave Chinner 2013-08-12 3252 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3253 * Lock all the participating inodes. Depending upon whether
f6bba2017afb3bd Dave Chinner 2013-08-12 3254 * the target_name exists in the target directory, and
f6bba2017afb3bd Dave Chinner 2013-08-12 3255 * whether the target directory is the same as the source
f6bba2017afb3bd Dave Chinner 2013-08-12 3256 * directory, we can lock from 2 to 4 inodes.
f6bba2017afb3bd Dave Chinner 2013-08-12 3257 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3258 xfs_lock_inodes(inodes, num_inodes, XFS_ILOCK_EXCL);
f6bba2017afb3bd Dave Chinner 2013-08-12 3259
f6bba2017afb3bd Dave Chinner 2013-08-12 3260 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3261 * Join all the inodes to the transaction. From this point on,
f6bba2017afb3bd Dave Chinner 2013-08-12 3262 * we can rely on either trans_commit or trans_cancel to unlock
f6bba2017afb3bd Dave Chinner 2013-08-12 3263 * them.
f6bba2017afb3bd Dave Chinner 2013-08-12 3264 */
3818584f03ce2d5 Allison Henderson 2021-03-24 3265 xfs_trans_ijoin(tp, src_dp, 0);
f6bba2017afb3bd Dave Chinner 2013-08-12 3266 if (new_parent)
3818584f03ce2d5 Allison Henderson 2021-03-24 3267 xfs_trans_ijoin(tp, target_dp, 0);
3818584f03ce2d5 Allison Henderson 2021-03-24 3268 xfs_trans_ijoin(tp, src_ip, 0);
f6bba2017afb3bd Dave Chinner 2013-08-12 3269 if (target_ip)
3818584f03ce2d5 Allison Henderson 2021-03-24 3270 xfs_trans_ijoin(tp, target_ip, 0);
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3271 if (wip)
3818584f03ce2d5 Allison Henderson 2021-03-24 3272 xfs_trans_ijoin(tp, wip, 0);
f6bba2017afb3bd Dave Chinner 2013-08-12 3273
f6bba2017afb3bd Dave Chinner 2013-08-12 3274 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3275 * If we are using project inheritance, we only allow renames
f6bba2017afb3bd Dave Chinner 2013-08-12 3276 * into our tree when the project IDs are the same; else the
f6bba2017afb3bd Dave Chinner 2013-08-12 3277 * tree quota mechanism would be circumvented.
f6bba2017afb3bd Dave Chinner 2013-08-12 3278 */
db07349da2f5647 Christoph Hellwig 2021-03-29 3279 if (unlikely((target_dp->i_diflags & XFS_DIFLAG_PROJINHERIT) &&
ceaf603c7024d3c Christoph Hellwig 2021-03-29 3280 target_dp->i_projid != src_ip->i_projid)) {
2451337dd043901 Dave Chinner 2014-06-25 3281 error = -EXDEV;
3818584f03ce2d5 Allison Henderson 2021-03-24 3282 goto out_unlock;
f6bba2017afb3bd Dave Chinner 2013-08-12 3283 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3284
eeacd3217b8fa81 Dave Chinner 2015-03-25 3285 /* RENAME_EXCHANGE is unique from here on. */
3818584f03ce2d5 Allison Henderson 2021-03-24 3286 if (flags & RENAME_EXCHANGE) {
3818584f03ce2d5 Allison Henderson 2021-03-24 3287 error = xfs_cross_rename(tp, src_dp, src_name, src_ip,
d31a1825450062b Carlos Maiolino 2014-12-24 3288 target_dp, target_name, target_ip,
f16dea54b789aad Brian Foster 2018-07-11 3289 spaceres);
3818584f03ce2d5 Allison Henderson 2021-03-24 3290 goto out_pptr;
3818584f03ce2d5 Allison Henderson 2021-03-24 3291 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3292 /*
bc56ad8c74b8588 kaixuxia 2019-09-03 3293 * Check for expected errors before we dirty the transaction
bc56ad8c74b8588 kaixuxia 2019-09-03 3294 * so we can return an error without a transaction abort.
02092a2f034fdea Chandan Babu R 2021-01-22 3295 *
02092a2f034fdea Chandan Babu R 2021-01-22 3296 * Extent count overflow check:
02092a2f034fdea Chandan Babu R 2021-01-22 3297 *
02092a2f034fdea Chandan Babu R 2021-01-22 3298 * From the perspective of src_dp, a rename operation is essentially a
02092a2f034fdea Chandan Babu R 2021-01-22 3299 * directory entry remove operation. Hence the only place where we check
02092a2f034fdea Chandan Babu R 2021-01-22 3300 * for extent count overflow for src_dp is in
02092a2f034fdea Chandan Babu R 2021-01-22 3301 * xfs_bmap_del_extent_real(). xfs_bmap_del_extent_real() returns
02092a2f034fdea Chandan Babu R 2021-01-22 3302 * -ENOSPC when it detects a possible extent count overflow and in
02092a2f034fdea Chandan Babu R 2021-01-22 3303 * response, the higher layers of directory handling code do the
02092a2f034fdea Chandan Babu R 2021-01-22 3304 * following:
02092a2f034fdea Chandan Babu R 2021-01-22 3305 * 1. Data/Free blocks: XFS lets these blocks linger until a
02092a2f034fdea Chandan Babu R 2021-01-22 3306 * future remove operation removes them.
02092a2f034fdea Chandan Babu R 2021-01-22 3307 * 2. Dabtree blocks: XFS swaps the blocks with the last block in the
02092a2f034fdea Chandan Babu R 2021-01-22 3308 * Leaf space and unmaps the last block.
02092a2f034fdea Chandan Babu R 2021-01-22 3309 *
02092a2f034fdea Chandan Babu R 2021-01-22 3310 * For target_dp, there are two cases depending on whether the
02092a2f034fdea Chandan Babu R 2021-01-22 3311 * destination directory entry exists or not.
02092a2f034fdea Chandan Babu R 2021-01-22 3312 *
02092a2f034fdea Chandan Babu R 2021-01-22 3313 * When destination directory entry does not exist (i.e. target_ip ==
02092a2f034fdea Chandan Babu R 2021-01-22 3314 * NULL), extent count overflow check is performed only when transaction
02092a2f034fdea Chandan Babu R 2021-01-22 3315 * has a non-zero sized space reservation associated with it. With a
02092a2f034fdea Chandan Babu R 2021-01-22 3316 * zero-sized space reservation, XFS allows a rename operation to
02092a2f034fdea Chandan Babu R 2021-01-22 3317 * continue only when the directory has sufficient free space in its
02092a2f034fdea Chandan Babu R 2021-01-22 3318 * data/leaf/free space blocks to hold the new entry.
02092a2f034fdea Chandan Babu R 2021-01-22 3319 *
02092a2f034fdea Chandan Babu R 2021-01-22 3320 * When destination directory entry exists (i.e. target_ip != NULL), all
02092a2f034fdea Chandan Babu R 2021-01-22 3321 * we need to do is change the inode number associated with the already
02092a2f034fdea Chandan Babu R 2021-01-22 3322 * existing entry. Hence there is no need to perform an extent count
02092a2f034fdea Chandan Babu R 2021-01-22 3323 * overflow check.
f6bba2017afb3bd Dave Chinner 2013-08-12 3324 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3325 if (target_ip == NULL) {
f6bba2017afb3bd Dave Chinner 2013-08-12 3326 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3327 * If there's no space reservation, check the entry will
f6bba2017afb3bd Dave Chinner 2013-08-12 3328 * fit before actually inserting it.
f6bba2017afb3bd Dave Chinner 2013-08-12 3329 */
94f3cad555d6604 Eric Sandeen 2014-09-09 3330 if (!spaceres) {
94f3cad555d6604 Eric Sandeen 2014-09-09 3331 error = xfs_dir_canenter(tp, target_dp, target_name);
f6bba2017afb3bd Dave Chinner 2013-08-12 3332 if (error)
3818584f03ce2d5 Allison Henderson 2021-03-24 3333 goto out_unlock;
02092a2f034fdea Chandan Babu R 2021-01-22 3334 } else {
02092a2f034fdea Chandan Babu R 2021-01-22 3335 error = xfs_iext_count_may_overflow(target_dp,
02092a2f034fdea Chandan Babu R 2021-01-22 3336 XFS_DATA_FORK,
02092a2f034fdea Chandan Babu R 2021-01-22 3337 XFS_IEXT_DIR_MANIP_CNT(mp));
02092a2f034fdea Chandan Babu R 2021-01-22 3338 if (error)
02092a2f034fdea Chandan Babu R 2021-01-22 3339 goto out_trans_cancel;
94f3cad555d6604 Eric Sandeen 2014-09-09 3340 }
bc56ad8c74b8588 kaixuxia 2019-09-03 3341 } else {
bc56ad8c74b8588 kaixuxia 2019-09-03 3342 /*
bc56ad8c74b8588 kaixuxia 2019-09-03 3343 * If target exists and it's a directory, check that whether
bc56ad8c74b8588 kaixuxia 2019-09-03 3344 * it can be destroyed.
bc56ad8c74b8588 kaixuxia 2019-09-03 3345 */
bc56ad8c74b8588 kaixuxia 2019-09-03 3346 if (S_ISDIR(VFS_I(target_ip)->i_mode) &&
bc56ad8c74b8588 kaixuxia 2019-09-03 3347 (!xfs_dir_isempty(target_ip) ||
bc56ad8c74b8588 kaixuxia 2019-09-03 3348 (VFS_I(target_ip)->i_nlink > 2))) {
bc56ad8c74b8588 kaixuxia 2019-09-03 3349 error = -EEXIST;
bc56ad8c74b8588 kaixuxia 2019-09-03 3350 goto out_trans_cancel;
bc56ad8c74b8588 kaixuxia 2019-09-03 3351 }
bc56ad8c74b8588 kaixuxia 2019-09-03 3352 }
bc56ad8c74b8588 kaixuxia 2019-09-03 3353
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3354 /*
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3355 * Lock the AGI buffers we need to handle bumping the nlink of the
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3356 * whiteout inode off the unlinked list and to handle dropping the
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3357 * nlink of the target inode. Per locking order rules, do this in
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3358 * increasing AG order and before directory block allocation tries to
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3359 * grab AGFs because we grab AGIs before AGFs.
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3360 *
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3361 * The (vfs) caller must ensure that if src is a directory then
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3362 * target_ip is either null or an empty directory.
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3363 */
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3364 for (i = 0; i < num_inodes && inodes[i] != NULL; i++) {
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3365 if (inodes[i] == wip ||
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3366 (inodes[i] == target_ip &&
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3367 (VFS_I(target_ip)->i_nlink == 1 || src_is_directory))) {
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3368 struct xfs_buf *bp;
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3369 xfs_agnumber_t agno;
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3370
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3371 agno = XFS_INO_TO_AGNO(mp, inodes[i]->i_ino);
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3372 error = xfs_read_agi(mp, tp, agno, &bp);
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3373 if (error)
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3374 goto out_trans_cancel;
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3375 }
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3376 }
6da1b4b1ab36d80 Darrick J. Wong 2021-01-22 3377
bc56ad8c74b8588 kaixuxia 2019-09-03 3378 /*
bc56ad8c74b8588 kaixuxia 2019-09-03 3379 * Directory entry creation below may acquire the AGF. Remove
bc56ad8c74b8588 kaixuxia 2019-09-03 3380 * the whiteout from the unlinked list first to preserve correct
bc56ad8c74b8588 kaixuxia 2019-09-03 3381 * AGI/AGF locking order. This dirties the transaction so failures
bc56ad8c74b8588 kaixuxia 2019-09-03 3382 * after this point will abort and log recovery will clean up the
bc56ad8c74b8588 kaixuxia 2019-09-03 3383 * mess.
bc56ad8c74b8588 kaixuxia 2019-09-03 3384 *
bc56ad8c74b8588 kaixuxia 2019-09-03 3385 * For whiteouts, we need to bump the link count on the whiteout
bc56ad8c74b8588 kaixuxia 2019-09-03 3386 * inode. After this point, we have a real link, clear the tmpfile
bc56ad8c74b8588 kaixuxia 2019-09-03 3387 * state flag from the inode so it doesn't accidentally get misused
bc56ad8c74b8588 kaixuxia 2019-09-03 3388 * in future.
bc56ad8c74b8588 kaixuxia 2019-09-03 3389 */
bc56ad8c74b8588 kaixuxia 2019-09-03 3390 if (wip) {
f40aadb2bb64fe0 Dave Chinner 2021-06-02 3391 struct xfs_perag *pag;
f40aadb2bb64fe0 Dave Chinner 2021-06-02 3392
bc56ad8c74b8588 kaixuxia 2019-09-03 3393 ASSERT(VFS_I(wip)->i_nlink == 0);
f40aadb2bb64fe0 Dave Chinner 2021-06-02 3394
f40aadb2bb64fe0 Dave Chinner 2021-06-02 3395 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, wip->i_ino));
f40aadb2bb64fe0 Dave Chinner 2021-06-02 3396 error = xfs_iunlink_remove(tp, pag, wip);
f40aadb2bb64fe0 Dave Chinner 2021-06-02 3397 xfs_perag_put(pag);
bc56ad8c74b8588 kaixuxia 2019-09-03 3398 if (error)
bc56ad8c74b8588 kaixuxia 2019-09-03 3399 goto out_trans_cancel;
bc56ad8c74b8588 kaixuxia 2019-09-03 3400
bc56ad8c74b8588 kaixuxia 2019-09-03 3401 xfs_bumplink(tp, wip);
bc56ad8c74b8588 kaixuxia 2019-09-03 3402 VFS_I(wip)->i_state &= ~I_LINKABLE;
bc56ad8c74b8588 kaixuxia 2019-09-03 3403 }
bc56ad8c74b8588 kaixuxia 2019-09-03 3404
bc56ad8c74b8588 kaixuxia 2019-09-03 3405 /*
bc56ad8c74b8588 kaixuxia 2019-09-03 3406 * Set up the target.
bc56ad8c74b8588 kaixuxia 2019-09-03 3407 */
bc56ad8c74b8588 kaixuxia 2019-09-03 3408 if (target_ip == NULL) {
f6bba2017afb3bd Dave Chinner 2013-08-12 3409 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3410 * If target does not exist and the rename crosses
f6bba2017afb3bd Dave Chinner 2013-08-12 3411 * directories, adjust the target directory link count
f6bba2017afb3bd Dave Chinner 2013-08-12 3412 * to account for the ".." reference from the new entry.
f6bba2017afb3bd Dave Chinner 2013-08-12 3413 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3414 error = xfs_dir_createname(tp, target_dp, target_name,
3818584f03ce2d5 Allison Henderson 2021-03-24 3415 src_ip->i_ino, spaceres, &new_diroffset);
f6bba2017afb3bd Dave Chinner 2013-08-12 3416 if (error)
c8eac49ef798a7d Brian Foster 2018-07-24 3417 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3418
f6bba2017afb3bd Dave Chinner 2013-08-12 3419 xfs_trans_ichgtime(tp, target_dp,
f6bba2017afb3bd Dave Chinner 2013-08-12 3420 XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
f6bba2017afb3bd Dave Chinner 2013-08-12 3421
f6bba2017afb3bd Dave Chinner 2013-08-12 3422 if (new_parent && src_is_directory) {
910832697cf8553 Eric Sandeen 2019-05-01 3423 xfs_bumplink(tp, target_dp);
f6bba2017afb3bd Dave Chinner 2013-08-12 3424 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3425 } else { /* target_ip != NULL */
f6bba2017afb3bd Dave Chinner 2013-08-12 3426 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3427 * Link the source inode under the target name.
f6bba2017afb3bd Dave Chinner 2013-08-12 3428 * If the source inode is a directory and we are moving
f6bba2017afb3bd Dave Chinner 2013-08-12 3429 * it across directories, its ".." entry will be
f6bba2017afb3bd Dave Chinner 2013-08-12 3430 * inconsistent until we replace that down below.
f6bba2017afb3bd Dave Chinner 2013-08-12 3431 *
f6bba2017afb3bd Dave Chinner 2013-08-12 3432 * In case there is already an entry with the same
f6bba2017afb3bd Dave Chinner 2013-08-12 3433 * name at the destination directory, remove it first.
f6bba2017afb3bd Dave Chinner 2013-08-12 3434 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3435 error = xfs_dir_replace(tp, target_dp, target_name,
3818584f03ce2d5 Allison Henderson 2021-03-24 3436 src_ip->i_ino, spaceres, &new_diroffset);
f6bba2017afb3bd Dave Chinner 2013-08-12 3437 if (error)
c8eac49ef798a7d Brian Foster 2018-07-24 3438 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3439
f6bba2017afb3bd Dave Chinner 2013-08-12 3440 xfs_trans_ichgtime(tp, target_dp,
f6bba2017afb3bd Dave Chinner 2013-08-12 3441 XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
f6bba2017afb3bd Dave Chinner 2013-08-12 3442
f6bba2017afb3bd Dave Chinner 2013-08-12 3443 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3444 * Decrement the link count on the target since the target
f6bba2017afb3bd Dave Chinner 2013-08-12 3445 * dir no longer points to it.
f6bba2017afb3bd Dave Chinner 2013-08-12 3446 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3447 error = xfs_droplink(tp, target_ip);
f6bba2017afb3bd Dave Chinner 2013-08-12 3448 if (error)
c8eac49ef798a7d Brian Foster 2018-07-24 3449 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3450
f6bba2017afb3bd Dave Chinner 2013-08-12 3451 if (src_is_directory) {
f6bba2017afb3bd Dave Chinner 2013-08-12 3452 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3453 * Drop the link from the old "." entry.
f6bba2017afb3bd Dave Chinner 2013-08-12 3454 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3455 error = xfs_droplink(tp, target_ip);
f6bba2017afb3bd Dave Chinner 2013-08-12 3456 if (error)
c8eac49ef798a7d Brian Foster 2018-07-24 3457 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3458 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3459 } /* target_ip != NULL */
f6bba2017afb3bd Dave Chinner 2013-08-12 3460
f6bba2017afb3bd Dave Chinner 2013-08-12 3461 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3462 * Remove the source.
f6bba2017afb3bd Dave Chinner 2013-08-12 3463 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3464 if (new_parent && src_is_directory) {
f6bba2017afb3bd Dave Chinner 2013-08-12 3465 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3466 * Rewrite the ".." entry to point to the new
f6bba2017afb3bd Dave Chinner 2013-08-12 3467 * directory.
f6bba2017afb3bd Dave Chinner 2013-08-12 3468 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3469 error = xfs_dir_replace(tp, src_ip, &xfs_name_dotdot,
3818584f03ce2d5 Allison Henderson 2021-03-24 3470 target_dp->i_ino, spaceres, &new_diroffset);
2451337dd043901 Dave Chinner 2014-06-25 3471 ASSERT(error != -EEXIST);
f6bba2017afb3bd Dave Chinner 2013-08-12 3472 if (error)
c8eac49ef798a7d Brian Foster 2018-07-24 3473 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3474 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3475
f6bba2017afb3bd Dave Chinner 2013-08-12 3476 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3477 * We always want to hit the ctime on the source inode.
f6bba2017afb3bd Dave Chinner 2013-08-12 3478 *
f6bba2017afb3bd Dave Chinner 2013-08-12 3479 * This isn't strictly required by the standards since the source
f6bba2017afb3bd Dave Chinner 2013-08-12 3480 * inode isn't really being changed, but old unix file systems did
f6bba2017afb3bd Dave Chinner 2013-08-12 3481 * it and some incremental backup programs won't work without it.
f6bba2017afb3bd Dave Chinner 2013-08-12 3482 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3483 xfs_trans_ichgtime(tp, src_ip, XFS_ICHGTIME_CHG);
f6bba2017afb3bd Dave Chinner 2013-08-12 3484 xfs_trans_log_inode(tp, src_ip, XFS_ILOG_CORE);
f6bba2017afb3bd Dave Chinner 2013-08-12 3485
f6bba2017afb3bd Dave Chinner 2013-08-12 3486 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3487 * Adjust the link count on src_dp. This is necessary when
f6bba2017afb3bd Dave Chinner 2013-08-12 3488 * renaming a directory, either within one parent when
f6bba2017afb3bd Dave Chinner 2013-08-12 3489 * the target existed, or across two parent directories.
f6bba2017afb3bd Dave Chinner 2013-08-12 3490 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3491 if (src_is_directory && (new_parent || target_ip != NULL)) {
f6bba2017afb3bd Dave Chinner 2013-08-12 3492
f6bba2017afb3bd Dave Chinner 2013-08-12 3493 /*
f6bba2017afb3bd Dave Chinner 2013-08-12 3494 * Decrement link count on src_directory since the
f6bba2017afb3bd Dave Chinner 2013-08-12 3495 * entry that's moved no longer points to it.
f6bba2017afb3bd Dave Chinner 2013-08-12 3496 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3497 error = xfs_droplink(tp, src_dp);
f6bba2017afb3bd Dave Chinner 2013-08-12 3498 if (error)
c8eac49ef798a7d Brian Foster 2018-07-24 3499 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3500 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3501
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3502 /*
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3503 * For whiteouts, we only need to update the source dirent with the
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3504 * inode number of the whiteout inode rather than removing it
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3505 * altogether.
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3506 */
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3507 if (wip) {
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3508 error = xfs_dir_replace(tp, src_dp, src_name, wip->i_ino,
3818584f03ce2d5 Allison Henderson 2021-03-24 3509 spaceres, &old_diroffset);
02092a2f034fdea Chandan Babu R 2021-01-22 3510 } else {
02092a2f034fdea Chandan Babu R 2021-01-22 3511 /*
02092a2f034fdea Chandan Babu R 2021-01-22 3512 * NOTE: We don't need to check for extent count overflow here
02092a2f034fdea Chandan Babu R 2021-01-22 3513 * because the dir remove name code will leave the dir block in
02092a2f034fdea Chandan Babu R 2021-01-22 3514 * place if the extent count would overflow.
02092a2f034fdea Chandan Babu R 2021-01-22 3515 */
f6bba2017afb3bd Dave Chinner 2013-08-12 3516 error = xfs_dir_removename(tp, src_dp, src_name, src_ip->i_ino,
3818584f03ce2d5 Allison Henderson 2021-03-24 3517 spaceres, &old_diroffset);
02092a2f034fdea Chandan Babu R 2021-01-22 3518 }
02092a2f034fdea Chandan Babu R 2021-01-22 3519
f6bba2017afb3bd Dave Chinner 2013-08-12 3520 if (error)
c8eac49ef798a7d Brian Foster 2018-07-24 3521 goto out_trans_cancel;
f6bba2017afb3bd Dave Chinner 2013-08-12 3522
3818584f03ce2d5 Allison Henderson 2021-03-24 3523 out_pptr:
3818584f03ce2d5 Allison Henderson 2021-03-24 3524 if (xfs_sb_version_hasparent(&mp->m_sb)) {
3818584f03ce2d5 Allison Henderson 2021-03-24 3525 new_args.trans = tp;
3818584f03ce2d5 Allison Henderson 2021-03-24 @3526 xfs_init_parent_name_rec(&new_rec, target_dp, new_diroffset);
3818584f03ce2d5 Allison Henderson 2021-03-24 3527 new_args.hashval = xfs_da_hashname(new_args.name,
3818584f03ce2d5 Allison Henderson 2021-03-24 3528 new_args.namelen);
3818584f03ce2d5 Allison Henderson 2021-03-24 3529 error = xfs_attr_set_deferred(&new_args);
3818584f03ce2d5 Allison Henderson 2021-03-24 3530 if (error)
3818584f03ce2d5 Allison Henderson 2021-03-24 3531 goto out_trans_cancel;
3818584f03ce2d5 Allison Henderson 2021-03-24 3532
3818584f03ce2d5 Allison Henderson 2021-03-24 3533 old_args.trans = tp;
3818584f03ce2d5 Allison Henderson 2021-03-24 @3534 xfs_init_parent_name_rec(&old_rec, src_dp, old_diroffset);
3818584f03ce2d5 Allison Henderson 2021-03-24 3535 old_args.hashval = xfs_da_hashname(old_args.name,
3818584f03ce2d5 Allison Henderson 2021-03-24 3536 old_args.namelen);
3818584f03ce2d5 Allison Henderson 2021-03-24 3537 error = xfs_attr_remove_deferred(&old_args);
3818584f03ce2d5 Allison Henderson 2021-03-24 3538 if (error)
3818584f03ce2d5 Allison Henderson 2021-03-24 3539 goto out_trans_cancel;
3818584f03ce2d5 Allison Henderson 2021-03-24 3540 }
3818584f03ce2d5 Allison Henderson 2021-03-24 3541
f6bba2017afb3bd Dave Chinner 2013-08-12 3542 xfs_trans_ichgtime(tp, src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
f6bba2017afb3bd Dave Chinner 2013-08-12 3543 xfs_trans_log_inode(tp, src_dp, XFS_ILOG_CORE);
f6bba2017afb3bd Dave Chinner 2013-08-12 3544 if (new_parent)
f6bba2017afb3bd Dave Chinner 2013-08-12 3545 xfs_trans_log_inode(tp, target_dp, XFS_ILOG_CORE);
f6bba2017afb3bd Dave Chinner 2013-08-12 3546
c9cfdb381172174 Brian Foster 2018-07-11 3547 error = xfs_finish_rename(tp);
3818584f03ce2d5 Allison Henderson 2021-03-24 3548
3818584f03ce2d5 Allison Henderson 2021-03-24 3549 out_unlock:
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3550 if (wip)
44a8736bd20a08e Darrick J. Wong 2018-07-25 3551 xfs_irele(wip);
3818584f03ce2d5 Allison Henderson 2021-03-24 3552 if (wip)
3818584f03ce2d5 Allison Henderson 2021-03-24 3553 xfs_iunlock(wip, XFS_ILOCK_EXCL);
3818584f03ce2d5 Allison Henderson 2021-03-24 3554 if (target_ip)
3818584f03ce2d5 Allison Henderson 2021-03-24 3555 xfs_iunlock(target_ip, XFS_ILOCK_EXCL);
3818584f03ce2d5 Allison Henderson 2021-03-24 3556 xfs_iunlock(src_ip, XFS_ILOCK_EXCL);
3818584f03ce2d5 Allison Henderson 2021-03-24 3557 if (new_parent)
3818584f03ce2d5 Allison Henderson 2021-03-24 3558 xfs_iunlock(target_dp, XFS_ILOCK_EXCL);
3818584f03ce2d5 Allison Henderson 2021-03-24 3559 xfs_iunlock(src_dp, XFS_ILOCK_EXCL);
3818584f03ce2d5 Allison Henderson 2021-03-24 3560
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3561 return error;
f6bba2017afb3bd Dave Chinner 2013-08-12 3562
445883e8133975f Dave Chinner 2015-03-25 3563 out_trans_cancel:
4906e21545814e4 Christoph Hellwig 2015-06-04 3564 xfs_trans_cancel(tp);
3818584f03ce2d5 Allison Henderson 2021-03-24 3565 drop_incompat:
3818584f03ce2d5 Allison Henderson 2021-03-24 3566 if (xfs_hasdelattr(mp))
3818584f03ce2d5 Allison Henderson 2021-03-24 3567 xlog_drop_incompat_feat(mp->m_log);
253f4911f297b83 Christoph Hellwig 2016-04-06 3568 out_release_wip:
7dcf5c3e4527cfa Dave Chinner 2015-03-25 3569 if (wip)
44a8736bd20a08e Darrick J. Wong 2018-07-25 3570 xfs_irele(wip);
f6bba2017afb3bd Dave Chinner 2013-08-12 3571 return error;
f6bba2017afb3bd Dave Chinner 2013-08-12 3572 }
f6bba2017afb3bd Dave Chinner 2013-08-12 3573
:::::: The code at line 3526 was first introduced by commit
:::::: 3818584f03ce2d5c1310199a6466aafdf22c8256 xfs: Add parent pointers to rename
:::::: TO: Allison Henderson <allison.henderson(a)oracle.com>
:::::: CC: Allison Henderson <allison.henderson(a)oracle.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[linux-next:master 4029/4668] fs/btrfs/ioctl.c:2421:3: warning: Value stored to 'dirid' is never read [clang-analyzer-deadcode.DeadStores]
by kernel test robot
CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Marcos Paulo de Souza <mpdesouza(a)suse.com>
CC: David Sterba <dsterba(a)suse.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 8d4b477da1a807199ca60e0829357ce7aa6758d5
commit: 2315a282149bab4e37c8ecd5c6cad4e62704c65a [4029/4668] btrfs: introduce btrfs_search_backwards function
:::::: branch date: 27 hours ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-c001-20210729 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c49df15c278857adecd12db6bb1cdc96885f7079)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 2315a282149bab4e37c8ecd5c6cad4e62704c65a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
drivers/hid/hid-ite.c:50:6: note: Assuming the condition is true
(usage->hid & HID_USAGE_PAGE) == 0x00880000) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-ite.c:49:2: note: Taking true branch
if ((quirks & QUIRK_TOUCHPAD_ON_OFF_REPORT) &&
^
drivers/hid/hid-ite.c:51:7: note: Assuming field 'hid' is equal to 8913016
if (usage->hid == 0x00880078) {
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-ite.c:51:3: note: Taking true branch
if (usage->hid == 0x00880078) {
^
drivers/hid/hid-ite.c:53:4: note: Calling 'hid_map_usage_clear'
hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_F22);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:1035:2: note: Calling 'hid_map_usage'
hid_map_usage(hidinput, usage, bit, max, type, c);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:982:2: note: 'input' initialized here
struct input_dev *input = hidinput->input;
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:986:2: note: Control jumps to 'case 1:' at line 995
switch (type) {
^
include/linux/hid.h:998:3: note: Execution continues on line 1005
break;
^
include/linux/hid.h:1005:15: note: 'c' is <= 'limit'
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:1005:15: note: Left side of '||' is false
if (unlikely(c > limit || !bmap)) {
^
include/linux/hid.h:1005:28: note: Assuming 'bmap' is null
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:1005:28: note: Assuming pointer value is null
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:1005:2: note: Taking true branch
if (unlikely(c > limit || !bmap)) {
^
include/linux/hid.h:1006:3: note: Assuming the condition is true
pr_warn_ratelimited("%s: Invalid code %d type %d\n",
^
include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:540:6: note: expanded from macro 'printk_ratelimited'
if (__ratelimit(&_rs)) \
^~~~~~~~~~~~~~~~~
include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit'
#define __ratelimit(state) ___ratelimit(state, __func__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:1006:3: note: Taking true branch
pr_warn_ratelimited("%s: Invalid code %d type %d\n",
^
include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:540:2: note: expanded from macro 'printk_ratelimited'
if (__ratelimit(&_rs)) \
^
include/linux/hid.h:1007:9: note: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input')
input->name, c, type);
^
include/linux/printk.h:557:49: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:541:17: note: expanded from macro 'printk_ratelimited'
printk(fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
fs/btrfs/ioctl.c:1420:16: warning: Value stored to 'cluster' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
unsigned long cluster = max_cluster;
^~~~~~~ ~~~~~~~~~~~
fs/btrfs/ioctl.c:1420:16: note: Value stored to 'cluster' during its initialization is never read
unsigned long cluster = max_cluster;
^~~~~~~ ~~~~~~~~~~~
fs/btrfs/ioctl.c:2107:3: warning: Value stored to 'i' is never read [clang-analyzer-deadcode.DeadStores]
i = nritems;
^ ~~~~~~~
fs/btrfs/ioctl.c:2107:3: note: Value stored to 'i' is never read
i = nritems;
^ ~~~~~~~
>> fs/btrfs/ioctl.c:2421:3: warning: Value stored to 'dirid' is never read [clang-analyzer-deadcode.DeadStores]
dirid = key.objectid;
^ ~~~~~~~~~~~~
fs/btrfs/ioctl.c:2421:3: note: Value stored to 'dirid' is never read
dirid = key.objectid;
^ ~~~~~~~~~~~~
fs/btrfs/ioctl.c:4660:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(super_block->label, label);
^~~~~~
fs/btrfs/ioctl.c:4660:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(super_block->label, label);
^~~~~~
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
fs/btrfs/ctree.h:2152:1: warning: Array access (via field 'pages') results in a null pointer dereference [clang-analyzer-core.NullDereference]
BTRFS_SETGET_HEADER_FUNCS(header_nritems, struct btrfs_header, nritems, 32);
^
fs/btrfs/ctree.h:1612:31: note: expanded from macro 'BTRFS_SETGET_HEADER_FUNCS'
const type *p = page_address(eb->pages[0]) + \
^
fs/btrfs/tree-log.c:6288:6: note: Assuming 'path' is non-null
if (!path)
^~~~~
fs/btrfs/tree-log.c:6288:2: note: Taking false branch
if (!path)
^
fs/btrfs/tree-log.c:6294:2: note: Taking false branch
if (IS_ERR(trans)) {
^
fs/btrfs/tree-log.c:6302:8: note: Calling 'walk_log_tree'
ret = walk_log_tree(trans, log_root_tree, &wc);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/tree-log.c:2892:6: note: Assuming 'path' is non-null
if (!path)
^~~~~
fs/btrfs/tree-log.c:2892:2: note: Taking false branch
if (!path)
^
fs/btrfs/tree-log.c:2901:2: note: Loop condition is true. Entering loop body
while (1) {
^
fs/btrfs/tree-log.c:2903:7: note: 'wret' is <= 0
if (wret > 0)
^~~~
fs/btrfs/tree-log.c:2903:3: note: Taking false branch
if (wret > 0)
^
fs/btrfs/tree-log.c:2905:7: note: 'wret' is >= 0
if (wret < 0) {
^~~~
fs/btrfs/tree-log.c:2905:3: note: Taking false branch
if (wret < 0) {
^
fs/btrfs/tree-log.c:2910:10: note: Calling 'walk_up_log_tree'
wret = walk_up_log_tree(trans, log, path, &level, wc);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/tree-log.c:2831:19: note: Left side of '&&' is true
for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) {
^
fs/btrfs/tree-log.c:2831:2: note: Loop condition is true. Entering loop body
for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) {
^
fs/btrfs/tree-log.c:2833:7: note: Assuming the condition is false
if (slot + 1 < btrfs_header_nritems(path->nodes[i])) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/tree-log.c:2833:3: note: Taking false branch
if (slot + 1 < btrfs_header_nritems(path->nodes[i])) {
^
fs/btrfs/tree-log.c:2842:8: note: 'ret' is 0
if (ret)
^~~
fs/btrfs/tree-log.c:2842:4: note: Taking false branch
if (ret)
^
fs/btrfs/tree-log.c:2845:12: note: Field 'free' is 0
if (wc->free) {
^
fs/btrfs/tree-log.c:2845:4: note: Taking false branch
if (wc->free) {
^
fs/btrfs/tree-log.c:2869:4: note: Storing null pointer value
path->nodes[*level] = NULL;
^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/tree-log.c:2831:19: note: Left side of '&&' is true
for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) {
^
fs/btrfs/tree-log.c:2831:2: note: Loop condition is true. Entering loop body
for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) {
^
fs/btrfs/tree-log.c:2833:7: note: Assuming the condition is false
if (slot + 1 < btrfs_header_nritems(path->nodes[i])) {
vim +/dirid +2421 fs/btrfs/ioctl.c
ac8e9819d71f90 Chris Mason 2010-02-28 2350
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2351 /*
ac8e9819d71f90 Chris Mason 2010-02-28 2352 * Search INODE_REFs to identify path name of 'dirid' directory
ac8e9819d71f90 Chris Mason 2010-02-28 2353 * in a 'tree_id' tree. and sets path name to 'name'.
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2354 */
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2355 static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2356 u64 tree_id, u64 dirid, char *name)
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2357 {
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2358 struct btrfs_root *root;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2359 struct btrfs_key key;
ac8e9819d71f90 Chris Mason 2010-02-28 2360 char *ptr;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2361 int ret = -1;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2362 int slot;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2363 int len;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2364 int total_len = 0;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2365 struct btrfs_inode_ref *iref;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2366 struct extent_buffer *l;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2367 struct btrfs_path *path;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2368
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2369 if (dirid == BTRFS_FIRST_FREE_OBJECTID) {
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2370 name[0]='\0';
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2371 return 0;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2372 }
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2373
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2374 path = btrfs_alloc_path();
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2375 if (!path)
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2376 return -ENOMEM;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2377
c8bcbfbd239ed6 Nikolay Borisov 2017-12-01 2378 ptr = &name[BTRFS_INO_LOOKUP_PATH_MAX - 1];
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2379
56e9357a1e8167 David Sterba 2020-05-15 2380 root = btrfs_get_fs_root(info, tree_id, true);
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2381 if (IS_ERR(root)) {
ad1e3d5672ddce Misono Tomohiro 2018-05-21 2382 ret = PTR_ERR(root);
88234012beaaf6 Josef Bacik 2020-01-24 2383 root = NULL;
88234012beaaf6 Josef Bacik 2020-01-24 2384 goto out;
88234012beaaf6 Josef Bacik 2020-01-24 2385 }
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2386
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2387 key.objectid = dirid;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2388 key.type = BTRFS_INODE_REF_KEY;
8ad6fcab564c5b Chris Mason 2010-03-18 2389 key.offset = (u64)-1;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2390
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2391 while (1) {
2315a282149bab Marcos Paulo de Souza 2021-07-29 2392 ret = btrfs_search_backwards(root, &key, path);
18674c6cc10e78 Filipe David Borba Manana 2013-08-14 2393 if (ret < 0)
18674c6cc10e78 Filipe David Borba Manana 2013-08-14 2394 goto out;
18674c6cc10e78 Filipe David Borba Manana 2013-08-14 2395 else if (ret > 0) {
18674c6cc10e78 Filipe David Borba Manana 2013-08-14 2396 ret = -ENOENT;
18674c6cc10e78 Filipe David Borba Manana 2013-08-14 2397 goto out;
18674c6cc10e78 Filipe David Borba Manana 2013-08-14 2398 }
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2399
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2400 l = path->nodes[0];
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2401 slot = path->slots[0];
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2402
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2403 iref = btrfs_item_ptr(l, slot, struct btrfs_inode_ref);
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2404 len = btrfs_inode_ref_name_len(l, iref);
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2405 ptr -= len + 1;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2406 total_len += len + 1;
a696cf3529cecd Filipe David Borba Manana 2013-08-14 2407 if (ptr < name) {
a696cf3529cecd Filipe David Borba Manana 2013-08-14 2408 ret = -ENAMETOOLONG;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2409 goto out;
a696cf3529cecd Filipe David Borba Manana 2013-08-14 2410 }
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2411
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2412 *(ptr + len) = '/';
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2413 read_extent_buffer(l, ptr, (unsigned long)(iref + 1), len);
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2414
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2415 if (key.offset == BTRFS_FIRST_FREE_OBJECTID)
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2416 break;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2417
b3b4aa74b58bde David Sterba 2011-04-21 2418 btrfs_release_path(path);
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2419 key.objectid = key.offset;
8ad6fcab564c5b Chris Mason 2010-03-18 2420 key.offset = (u64)-1;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 @2421 dirid = key.objectid;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2422 }
77906a5075a4eb Li Zefan 2011-07-14 2423 memmove(name, ptr, total_len);
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2424 name[total_len] = '\0';
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2425 ret = 0;
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2426 out:
0024652895e347 Josef Bacik 2020-01-24 2427 btrfs_put_root(root);
98d377a0894e6b TARUISI Hiroaki 2009-11-18 2428 btrfs_free_path(path);
ac8e9819d71f90 Chris Mason 2010-02-28 2429 return ret;
ac8e9819d71f90 Chris Mason 2010-02-28 2430 }
ac8e9819d71f90 Chris Mason 2010-02-28 2431
:::::: The code at line 2421 was first introduced by commit
:::::: 98d377a0894e6bcca44eafd4d2eee74e8af4db83 Btrfs: add a function to lookup a directory path by following backrefs
:::::: TO: TARUISI Hiroaki <taruishi.hiroak(a)jp.fujitsu.com>
:::::: CC: Chris Mason <chris.mason(a)oracle.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[intel-linux-intel-lts:4.19/android_r 19120/24281] arch/x86/kernel/smp.c:273:1: sparse: sparse: unused label 'finish'
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: "Pan, Kris" <kris.pan(a)intel.com>
tree: https://github.com/intel/linux-intel-lts.git 4.19/android_r
head: bab33a719ee83c9aa6b042027bf76e0c6916eeed
commit: b652a52d36a85d1b731921ba08e701d7150ce200 [19120/24281] Merge branch 'aosp/android-4.19-stable' into android_r
:::::: branch date: 2 days ago
:::::: commit date: 11 months ago
config: i386-randconfig-s002-20210730 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/intel/linux-intel-lts/commit/b652a52d36a85d1b731921ba0...
git remote add intel-linux-intel-lts https://github.com/intel/linux-intel-lts.git
git fetch --no-tags intel-linux-intel-lts 4.19/android_r
git checkout b652a52d36a85d1b731921ba08e701d7150ce200
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> arch/x86/kernel/smp.c:273:1: sparse: sparse: unused label 'finish'
arch/x86/kernel/smp.c:190:16: warning: no previous prototype for 'smp_reboot_interrupt' [-Wmissing-prototypes]
190 | __visible void smp_reboot_interrupt(struct pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/smp.c: In function 'native_stop_other_cpus':
arch/x86/kernel/smp.c:273:1: warning: label 'finish' defined but not used [-Wunused-label]
273 | finish:
| ^~~~~~
arch/x86/kernel/smp.c: At top level:
arch/x86/kernel/smp.c:285:28: warning: no previous prototype for 'smp_reschedule_interrupt' [-Wmissing-prototypes]
285 | __visible void __irq_entry smp_reschedule_interrupt(struct pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/smp.c:306:28: warning: no previous prototype for 'smp_call_function_interrupt' [-Wmissing-prototypes]
306 | __visible void __irq_entry smp_call_function_interrupt(struct pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/smp.c:316:28: warning: no previous prototype for 'smp_call_function_single_interrupt' [-Wmissing-prototypes]
316 | __visible void __irq_entry smp_call_function_single_interrupt(struct pt_regs *r)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/finish +273 arch/x86/kernel/smp.c
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 204
5d2b86d90f7cc4 Don Zickus 2012-05-11 205 static void native_stop_other_cpus(int wait)
f9e47a126be2ea Glauber Costa 2008-03-03 206 {
f9e47a126be2ea Glauber Costa 2008-03-03 207 unsigned long flags;
76fac077db6b34 Alok Kataria 2010-10-11 208 unsigned long timeout;
f9e47a126be2ea Glauber Costa 2008-03-03 209
f9e47a126be2ea Glauber Costa 2008-03-03 210 if (reboot_force)
f9e47a126be2ea Glauber Costa 2008-03-03 211 return;
f9e47a126be2ea Glauber Costa 2008-03-03 212
4ef702c10b5df1 Andi Kleen 2009-05-27 213 /*
4ef702c10b5df1 Andi Kleen 2009-05-27 214 * Use an own vector here because smp_call_function
4ef702c10b5df1 Andi Kleen 2009-05-27 215 * does lots of things not suitable in a panic situation.
7d007d21e539db Don Zickus 2012-05-11 216 */
7d007d21e539db Don Zickus 2012-05-11 217
7d007d21e539db Don Zickus 2012-05-11 218 /*
7d007d21e539db Don Zickus 2012-05-11 219 * We start by using the REBOOT_VECTOR irq.
7d007d21e539db Don Zickus 2012-05-11 220 * The irq is treated as a sync point to allow critical
7d007d21e539db Don Zickus 2012-05-11 221 * regions of code on other cpus to release their spin locks
7d007d21e539db Don Zickus 2012-05-11 222 * and re-enable irqs. Jumping straight to an NMI might
7d007d21e539db Don Zickus 2012-05-11 223 * accidentally cause deadlocks with further shutdown/panic
7d007d21e539db Don Zickus 2012-05-11 224 * code. By syncing, we give the cpus up to one second to
7d007d21e539db Don Zickus 2012-05-11 225 * finish their work before we force them off with the NMI.
4ef702c10b5df1 Andi Kleen 2009-05-27 226 */
4ef702c10b5df1 Andi Kleen 2009-05-27 227 if (num_online_cpus() > 1) {
7d007d21e539db Don Zickus 2012-05-11 228 /* did someone beat us here? */
7d007d21e539db Don Zickus 2012-05-11 229 if (atomic_cmpxchg(&stopping_cpu, -1, safe_smp_processor_id()) != -1)
7d007d21e539db Don Zickus 2012-05-11 230 return;
7d007d21e539db Don Zickus 2012-05-11 231
7d007d21e539db Don Zickus 2012-05-11 232 /* sync above data before sending IRQ */
7d007d21e539db Don Zickus 2012-05-11 233 wmb();
7d007d21e539db Don Zickus 2012-05-11 234
4ef702c10b5df1 Andi Kleen 2009-05-27 235 apic->send_IPI_allbutself(REBOOT_VECTOR);
4ef702c10b5df1 Andi Kleen 2009-05-27 236
76fac077db6b34 Alok Kataria 2010-10-11 237 /*
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 238 * Don't wait longer than a second for IPI completion. The
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 239 * wait request is not checked here because that would
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 240 * prevent an NMI shutdown attempt in case that not all
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 241 * CPUs reach shutdown state.
76fac077db6b34 Alok Kataria 2010-10-11 242 */
76fac077db6b34 Alok Kataria 2010-10-11 243 timeout = USEC_PER_SEC;
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 244 while (num_online_cpus() > 1 && timeout--)
4ef702c10b5df1 Andi Kleen 2009-05-27 245 udelay(1);
4ef702c10b5df1 Andi Kleen 2009-05-27 246 }
4ef702c10b5df1 Andi Kleen 2009-05-27 247
7d007d21e539db Don Zickus 2012-05-11 248 /* if the REBOOT_VECTOR didn't work, try with the NMI */
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 249 if (num_online_cpus() > 1) {
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 250 /*
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 251 * If NMI IPI is enabled, try to register the stop handler
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 252 * and send the IPI. In any case try to wait for the other
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 253 * CPUs to stop.
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 254 */
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 255 if (!smp_no_nmi_ipi && !register_stop_handler()) {
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 256 /* Sync above data before sending IRQ */
7d007d21e539db Don Zickus 2012-05-11 257 wmb();
7d007d21e539db Don Zickus 2012-05-11 258
7d007d21e539db Don Zickus 2012-05-11 259 pr_emerg("Shutting down cpus with NMI\n");
7d007d21e539db Don Zickus 2012-05-11 260
7d007d21e539db Don Zickus 2012-05-11 261 apic->send_IPI_allbutself(NMI_VECTOR);
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 262 }
7d007d21e539db Don Zickus 2012-05-11 263 /*
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 264 * Don't wait longer than 10 ms if the caller didn't
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 265 * reqeust it. If wait is true, the machine hangs here if
ce7fdd5cd83e0a Grzegorz Halat 2019-06-28 266 * one or more CPUs do not reach shutdown state.
7d007d21e539db Don Zickus 2012-05-11 267 */
7d007d21e539db Don Zickus 2012-05-11 268 timeout = USEC_PER_MSEC * 10;
7d007d21e539db Don Zickus 2012-05-11 269 while (num_online_cpus() > 1 && (wait || timeout--))
7d007d21e539db Don Zickus 2012-05-11 270 udelay(1);
7d007d21e539db Don Zickus 2012-05-11 271 }
7d007d21e539db Don Zickus 2012-05-11 272
7d007d21e539db Don Zickus 2012-05-11 @273 finish:
cd7b77710e3d52 Duan, YayongX 2017-12-27 274 store_regs(NULL);
f9e47a126be2ea Glauber Costa 2008-03-03 275 local_irq_save(flags);
f9e47a126be2ea Glauber Costa 2008-03-03 276 disable_local_APIC();
8838eb6c0bf3b6 Ashok Raj 2015-08-12 277 mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
f9e47a126be2ea Glauber Costa 2008-03-03 278 local_irq_restore(flags);
f9e47a126be2ea Glauber Costa 2008-03-03 279 }
f9e47a126be2ea Glauber Costa 2008-03-03 280
:::::: The code at line 273 was first introduced by commit
:::::: 7d007d21e539dbecb6942c5734e6649f720982cf x86/reboot: Use NMI to assist in shutting down if IRQ fails
:::::: TO: Don Zickus <dzickus(a)redhat.com>
:::::: CC: Ingo Molnar <mingo(a)kernel.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[linux-next:master 4175/4668] net/dsa/tag_sja1105.c:564 sja1110_rcv() error: uninitialized symbol 'vid'.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Vladimir Oltean <vladimir.oltean(a)nxp.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 8d4b477da1a807199ca60e0829357ce7aa6758d5
commit: 04a1758348a87eb73b8a4554d0c227831e2bb33e [4175/4668] net: dsa: tag_sja1105: fix control packets on SJA1110 being received on an imprecise port
:::::: branch date: 19 hours ago
:::::: commit date: 2 days ago
config: i386-randconfig-m021-20210730 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
net/dsa/tag_sja1105.c:564 sja1110_rcv() error: uninitialized symbol 'vid'.
vim +/vid +564 net/dsa/tag_sja1105.c
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 542
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 543 static struct sk_buff *sja1110_rcv(struct sk_buff *skb,
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 544 struct net_device *netdev,
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 545 struct packet_type *pt)
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 546 {
0fac6aa098edf9 Vladimir Oltean 2021-07-19 547 int source_port = -1, switch_id = -1;
884be12f85666c Vladimir Oltean 2021-07-26 548 u16 vid;
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 549
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 550 skb->offload_fwd_mark = 1;
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 551
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 552 if (sja1110_skb_has_inband_control_extension(skb)) {
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 553 skb = sja1110_rcv_inband_control_extension(skb, &source_port,
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 554 &switch_id);
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 555 if (!skb)
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 556 return NULL;
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 557 }
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 558
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 559 /* Packets with in-band control extensions might still have RX VLANs */
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 560 if (likely(sja1105_skb_has_tag_8021q(skb)))
04a1758348a87e Vladimir Oltean 2021-07-29 561 sja1105_vlan_rcv(skb, &source_port, &switch_id, &vid);
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 562
04a1758348a87e Vladimir Oltean 2021-07-29 563 if (source_port == -1 || switch_id == -1)
884be12f85666c Vladimir Oltean 2021-07-26 @564 skb->dev = dsa_find_designated_bridge_port_by_vid(netdev, vid);
884be12f85666c Vladimir Oltean 2021-07-26 565 else
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 566 skb->dev = dsa_master_find_slave(netdev, switch_id, source_port);
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 567 if (!skb->dev) {
884be12f85666c Vladimir Oltean 2021-07-26 568 netdev_warn(netdev, "Couldn't decode source port\n");
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 569 return NULL;
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 570 }
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 571
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 572 return skb;
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 573 }
4913b8ebf8a9c5 Vladimir Oltean 2021-06-11 574
:::::: The code at line 564 was first introduced by commit
:::::: 884be12f85666c6e9ff1cf3ead06a7371f6863dc net: dsa: sja1105: add support for imprecise RX
:::::: TO: Vladimir Oltean <vladimir.oltean(a)nxp.com>
:::::: CC: David S. Miller <davem(a)davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[linux-next:master 3868/4668] fs/btrfs/verity.c:125:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
by kernel test robot
CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Boris Burkov <boris(a)bur.io>
CC: David Sterba <dsterba(a)suse.com>
CC: Chris Mason <chris.mason(a)fusionio.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 8d4b477da1a807199ca60e0829357ce7aa6758d5
commit: 6875cbd232c7c516e6b2dd2b40c6eda6a552d619 [3868/4668] btrfs: initial fsverity support
:::::: branch date: 17 hours ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-c001-20210729 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c49df15c278857adecd12db6bb1cdc96885f7079)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 6875cbd232c7c516e6b2dd2b40c6eda6a552d619
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
drivers/char/agp/isoch.c:344:2: note: Assuming the condition is false
for_each_pci_dev(dev) {
^
include/linux/pci.h:522:36: note: expanded from macro 'for_each_pci_dev'
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/char/agp/isoch.c:344:2: note: Loop condition is false. Execution continues on line 387
for_each_pci_dev(dev) {
^
include/linux/pci.h:522:29: note: expanded from macro 'for_each_pci_dev'
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
^
drivers/char/agp/isoch.c:387:2: note: Loop condition is false. Execution continues on line 441
list_for_each(pos, head) {
^
include/linux/list.h:571:2: note: expanded from macro 'list_for_each'
for (pos = (head)->next; pos != (head); pos = pos->next)
^
drivers/char/agp/isoch.c:441:6: note: 'isoch' is not equal to 0
if (isoch) {
^~~~~
drivers/char/agp/isoch.c:441:2: note: Taking true branch
if (isoch) {
^
drivers/char/agp/isoch.c:443:7: note: Assuming 'ret' is not equal to 0
if (ret) {
^~~
drivers/char/agp/isoch.c:443:3: note: Taking true branch
if (ret) {
^
drivers/char/agp/isoch.c:451:55: note: Passing the value 0 via 3rd parameter 'ndevs'
agp_3_5_nonisochronous_node_enable(bridge, dev_list, ndevs);
^~~~~
drivers/char/agp/isoch.c:451:2: note: Calling 'agp_3_5_nonisochronous_node_enable'
agp_3_5_nonisochronous_node_enable(bridge, dev_list, ndevs);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/char/agp/isoch.c:295:12: note: Division by zero
mrq = trq / ndevs;
~~~~^~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
fs/nfs/direct.c:703:19: warning: Value stored to 'req' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nfs/direct.c:703:19: note: Value stored to 'req' during its initialization is never read
struct nfs_page *req = nfs_list_entry(hdr->pages.next);
^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 9 warnings (9 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
drivers/gpu/vga/vga_switcheroo.c:861:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = vgasr_priv.handler->switchto(client_id);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/vga/vga_switcheroo.c:861:3: note: Value stored to 'ret' is never read
ret = vgasr_priv.handler->switchto(client_id);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
>> fs/btrfs/verity.c:125:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/btrfs/verity.c:125:4: note: Value stored to 'ret' is never read
ret = 0;
^ ~
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
fs/gfs2/bmap.c:1848:3: warning: 6th function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
metapointer_range(&mp, mp_h, start_list, start_aligned,
^
fs/gfs2/bmap.c:2460:7: note: Calling 'gfs2_is_stuffed'
if (!gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:22:9: note: Assuming field 'i_height' is not equal to 0
return !ip->i_height;
^~~~~~~~~~~~~
fs/gfs2/inode.h:22:2: note: Returning zero, which participates in a condition later
return !ip->i_height;
^~~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2460:7: note: Returning from 'gfs2_is_stuffed'
if (!gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2460:2: note: Taking true branch
if (!gfs2_is_stuffed(ip)) {
^
fs/gfs2/bmap.c:2465:7: note: Assuming 'start_off' is 0
if (start_off) {
^~~~~~~~~
fs/gfs2/bmap.c:2465:3: note: Taking false branch
if (start_off) {
^
fs/gfs2/bmap.c:2475:7: note: Assuming 'end_len' is 0
if (end_len) {
^~~~~~~
fs/gfs2/bmap.c:2475:3: note: Taking false branch
if (end_len) {
^
fs/gfs2/bmap.c:2486:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/bmap.c:2486:2: note: Taking false branch
if (error)
^
fs/gfs2/bmap.c:2489:6: note: Assuming the condition is false
if (gfs2_is_jdata(ip))
^~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2489:2: note: Taking false branch
if (gfs2_is_jdata(ip))
^
fs/gfs2/bmap.c:2494:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/bmap.c:2494:2: note: Taking false branch
if (error)
^
fs/gfs2/bmap.c:2497:6: note: Calling 'gfs2_is_stuffed'
if (gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:22:14: note: Field 'i_height' is not equal to 0
return !ip->i_height;
^
fs/gfs2/inode.h:22:2: note: Returning zero, which participates in a condition later
return !ip->i_height;
^~~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2497:6: note: Returning from 'gfs2_is_stuffed'
if (gfs2_is_stuffed(ip)) {
^~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2497:2: note: Taking false branch
if (gfs2_is_stuffed(ip)) {
^
fs/gfs2/bmap.c:2503:6: note: Calling 'gfs2_is_jdata'
if (gfs2_is_jdata(ip)) {
^~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:27:2: note: Returning zero, which participates in a condition later
return ip->i_diskflags & GFS2_DIF_JDATA;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2503:6: note: Returning from 'gfs2_is_jdata'
if (gfs2_is_jdata(ip)) {
^~~~~~~~~~~~~~~~~
fs/gfs2/bmap.c:2503:2: note: Taking false branch
if (gfs2_is_jdata(ip)) {
^
fs/gfs2/bmap.c:2512:6: note: Assuming field 'journal_info' is null
if (current->journal_info)
^
arch/x86/include/asm/current.h:18:17: note: expanded from macro 'current'
#define current get_current()
^
fs/gfs2/bmap.c:2512:2: note: Taking false branch
if (current->journal_info)
^
fs/gfs2/bmap.c:2515:7: note: Calling 'gfs2_is_stuffed'
if (!gfs2_is_stuffed(ip))
^~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.h:22:9: note: Assuming field 'i_height' is not equal to 0
return !ip->i_height;
vim +/ret +125 fs/btrfs/verity.c
6875cbd232c7c5 Boris Burkov 2021-06-30 81
6875cbd232c7c5 Boris Burkov 2021-06-30 82 /*
6875cbd232c7c5 Boris Burkov 2021-06-30 83 * Drop all the items for this inode with this key_type.
6875cbd232c7c5 Boris Burkov 2021-06-30 84 *
6875cbd232c7c5 Boris Burkov 2021-06-30 85 * @inode: inode to drop items for
6875cbd232c7c5 Boris Burkov 2021-06-30 86 * @key_type: type of items to drop (BTRFS_VERITY_DESC_ITEM or
6875cbd232c7c5 Boris Burkov 2021-06-30 87 * BTRFS_VERITY_MERKLE_ITEM)
6875cbd232c7c5 Boris Burkov 2021-06-30 88 *
6875cbd232c7c5 Boris Burkov 2021-06-30 89 * Before doing a verity enable we cleanup any existing verity items.
6875cbd232c7c5 Boris Burkov 2021-06-30 90 * This is also used to clean up if a verity enable failed half way through.
6875cbd232c7c5 Boris Burkov 2021-06-30 91 *
6875cbd232c7c5 Boris Burkov 2021-06-30 92 * Returns number of dropped items on success, negative error code on failure.
6875cbd232c7c5 Boris Burkov 2021-06-30 93 */
6875cbd232c7c5 Boris Burkov 2021-06-30 94 static int drop_verity_items(struct btrfs_inode *inode, u8 key_type)
6875cbd232c7c5 Boris Burkov 2021-06-30 95 {
6875cbd232c7c5 Boris Burkov 2021-06-30 96 struct btrfs_trans_handle *trans;
6875cbd232c7c5 Boris Burkov 2021-06-30 97 struct btrfs_root *root = inode->root;
6875cbd232c7c5 Boris Burkov 2021-06-30 98 struct btrfs_path *path;
6875cbd232c7c5 Boris Burkov 2021-06-30 99 struct btrfs_key key;
6875cbd232c7c5 Boris Burkov 2021-06-30 100 int count = 0;
6875cbd232c7c5 Boris Burkov 2021-06-30 101 int ret;
6875cbd232c7c5 Boris Burkov 2021-06-30 102
6875cbd232c7c5 Boris Burkov 2021-06-30 103 path = btrfs_alloc_path();
6875cbd232c7c5 Boris Burkov 2021-06-30 104 if (!path)
6875cbd232c7c5 Boris Burkov 2021-06-30 105 return -ENOMEM;
6875cbd232c7c5 Boris Burkov 2021-06-30 106
6875cbd232c7c5 Boris Burkov 2021-06-30 107 while (1) {
6875cbd232c7c5 Boris Burkov 2021-06-30 108 /* 1 for the item being dropped */
6875cbd232c7c5 Boris Burkov 2021-06-30 109 trans = btrfs_start_transaction(root, 1);
6875cbd232c7c5 Boris Burkov 2021-06-30 110 if (IS_ERR(trans)) {
6875cbd232c7c5 Boris Burkov 2021-06-30 111 ret = PTR_ERR(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 112 goto out;
6875cbd232c7c5 Boris Burkov 2021-06-30 113 }
6875cbd232c7c5 Boris Burkov 2021-06-30 114
6875cbd232c7c5 Boris Burkov 2021-06-30 115 /*
6875cbd232c7c5 Boris Burkov 2021-06-30 116 * Walk backwards through all the items until we find one that
6875cbd232c7c5 Boris Burkov 2021-06-30 117 * isn't from our key type or objectid
6875cbd232c7c5 Boris Burkov 2021-06-30 118 */
6875cbd232c7c5 Boris Burkov 2021-06-30 119 key.objectid = btrfs_ino(inode);
6875cbd232c7c5 Boris Burkov 2021-06-30 120 key.type = key_type;
6875cbd232c7c5 Boris Burkov 2021-06-30 121 key.offset = (u64)-1;
6875cbd232c7c5 Boris Burkov 2021-06-30 122
6875cbd232c7c5 Boris Burkov 2021-06-30 123 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
6875cbd232c7c5 Boris Burkov 2021-06-30 124 if (ret > 0) {
6875cbd232c7c5 Boris Burkov 2021-06-30 @125 ret = 0;
6875cbd232c7c5 Boris Burkov 2021-06-30 126 /* No more keys of this type, we're done */
6875cbd232c7c5 Boris Burkov 2021-06-30 127 if (path->slots[0] == 0)
6875cbd232c7c5 Boris Burkov 2021-06-30 128 break;
6875cbd232c7c5 Boris Burkov 2021-06-30 129 path->slots[0]--;
6875cbd232c7c5 Boris Burkov 2021-06-30 130 } else if (ret < 0) {
6875cbd232c7c5 Boris Burkov 2021-06-30 131 btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 132 goto out;
6875cbd232c7c5 Boris Burkov 2021-06-30 133 }
6875cbd232c7c5 Boris Burkov 2021-06-30 134
6875cbd232c7c5 Boris Burkov 2021-06-30 135 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
6875cbd232c7c5 Boris Burkov 2021-06-30 136
6875cbd232c7c5 Boris Burkov 2021-06-30 137 /* No more keys of this type, we're done */
6875cbd232c7c5 Boris Burkov 2021-06-30 138 if (key.objectid != btrfs_ino(inode) || key.type != key_type)
6875cbd232c7c5 Boris Burkov 2021-06-30 139 break;
6875cbd232c7c5 Boris Burkov 2021-06-30 140
6875cbd232c7c5 Boris Burkov 2021-06-30 141 /*
6875cbd232c7c5 Boris Burkov 2021-06-30 142 * This shouldn't be a performance sensitive function because
6875cbd232c7c5 Boris Burkov 2021-06-30 143 * it's not used as part of truncate. If it ever becomes
6875cbd232c7c5 Boris Burkov 2021-06-30 144 * perf sensitive, change this to walk forward and bulk delete
6875cbd232c7c5 Boris Burkov 2021-06-30 145 * items
6875cbd232c7c5 Boris Burkov 2021-06-30 146 */
6875cbd232c7c5 Boris Burkov 2021-06-30 147 ret = btrfs_del_items(trans, root, path, path->slots[0], 1);
6875cbd232c7c5 Boris Burkov 2021-06-30 148 if (ret) {
6875cbd232c7c5 Boris Burkov 2021-06-30 149 btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 150 goto out;
6875cbd232c7c5 Boris Burkov 2021-06-30 151 }
6875cbd232c7c5 Boris Burkov 2021-06-30 152 count++;
6875cbd232c7c5 Boris Burkov 2021-06-30 153 btrfs_release_path(path);
6875cbd232c7c5 Boris Burkov 2021-06-30 154 btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 155 }
6875cbd232c7c5 Boris Burkov 2021-06-30 156 ret = count;
6875cbd232c7c5 Boris Burkov 2021-06-30 157 btrfs_end_transaction(trans);
6875cbd232c7c5 Boris Burkov 2021-06-30 158 out:
6875cbd232c7c5 Boris Burkov 2021-06-30 159 btrfs_free_path(path);
6875cbd232c7c5 Boris Burkov 2021-06-30 160 return ret;
6875cbd232c7c5 Boris Burkov 2021-06-30 161 }
6875cbd232c7c5 Boris Burkov 2021-06-30 162
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
net/bluetooth/hci_sock.c:918 hci_set_raw() warn: passing a valid pointer to 'PTR_ERR'
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Tetsuo Handa <penguin-kernel(a)i-love.sakura.ne.jp>
CC: 0day robot <lkp(a)intel.com>
tree: https://github.com/0day-ci/linux/commits/UPDATE-20210731-104259/Tetsuo-Ha...
head: e66f8c795ca2e66d4b1e630f074f0020edbc361d
commit: e66f8c795ca2e66d4b1e630f074f0020edbc361d Bluetooth: reorganize ioctls from hci_sock_bound_ioctl()
date: 5 hours ago
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: i386-randconfig-m021-20210730 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
net/bluetooth/hci_sock.c:918 hci_set_raw() warn: passing a valid pointer to 'PTR_ERR'
net/bluetooth/hci_sock.c:942 hci_get_conn_info() warn: passing a valid pointer to 'PTR_ERR'
net/bluetooth/hci_sock.c:979 hci_get_auth_info() warn: passing a valid pointer to 'PTR_ERR'
net/bluetooth/hci_sock.c:1009 hci_sock_reject_list_add() warn: passing a valid pointer to 'PTR_ERR'
net/bluetooth/hci_sock.c:1035 hci_sock_reject_list_del() warn: passing a valid pointer to 'PTR_ERR'
Old smatch warnings:
net/bluetooth/hci_sock.c:1611 hci_mgmt_cmd() warn: is 'buf' large enough for 'struct mgmt_hdr'? s32min
vim +/PTR_ERR +918 net/bluetooth/hci_sock.c
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 909
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 910 static int hci_set_raw(struct sock *sk)
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 911 {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 912 struct hci_dev *hdev;
5e762444b0d3e5 Antti Julku 2011-08-25 913 int err;
f03585689fdff4 Johan Hedberg 2010-05-18 914
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 915 lock_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 916 hdev = validate_hdev_from_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 917 if (IS_ERR(hdev))
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 @918 err = PTR_ERR(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 919 else if (!capable(CAP_NET_ADMIN))
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 920 err = -EPERM;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 921 else
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 922 err = -EOPNOTSUPP;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 923 release_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 924 return err;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 925 }
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 926
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 927 static int hci_get_conn_info(struct sock *sk, void __user *arg)
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 928 {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 929 struct hci_dev *hdev;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 930 struct hci_conn_info_req req;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 931 struct hci_conn_info ci;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 932 struct hci_conn *conn;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 933 int err = 0;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 934 char __user *ptr = arg + sizeof(req);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 935
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 936 if (copy_from_user(&req, arg, sizeof(req)))
f03585689fdff4 Johan Hedberg 2010-05-18 937 return -EFAULT;
f03585689fdff4 Johan Hedberg 2010-05-18 938
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 939 lock_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 940 hdev = validate_hdev_from_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 941 if (IS_ERR(hdev)) {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 @942 err = PTR_ERR(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 943 goto out;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 944 }
09fd0de5bd8f8e Gustavo Padovan 2011-06-17 945 hci_dev_lock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 946 conn = hci_conn_hash_lookup_ba(hdev, req.type, &req.bdaddr);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 947 if (conn) {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 948 bacpy(&ci.bdaddr, &conn->dst);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 949 ci.handle = conn->handle;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 950 ci.type = conn->type;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 951 ci.out = conn->out;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 952 ci.state = conn->state;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 953 ci.link_mode = hci_get_link_mode(conn);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 954 } else {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 955 err = -ENOENT;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 956 }
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 957 hci_dev_unlock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 958 out:
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 959 release_sock(sk);
5e762444b0d3e5 Antti Julku 2011-08-25 960
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 961 if (!err)
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 962 err = copy_to_user(ptr, &ci, sizeof(ci)) ? -EFAULT : 0;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 963 return err;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 964 }
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 965
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 966 static int hci_get_auth_info(struct sock *sk, void __user *arg)
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 967 {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 968 struct hci_dev *hdev;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 969 struct hci_auth_info_req req;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 970 struct hci_conn *conn;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 971 int err = 0;
5e762444b0d3e5 Antti Julku 2011-08-25 972
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 973 if (copy_from_user(&req, arg, sizeof(req)))
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 974 return -EFAULT;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 975
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 976 lock_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 977 hdev = validate_hdev_from_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 978 if (IS_ERR(hdev)) {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 @979 err = PTR_ERR(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 980 goto out;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 981 }
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 982 hci_dev_lock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 983 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &req.bdaddr);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 984 if (conn)
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 985 req.type = conn->auth_type;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 986 else
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 987 err = -ENOENT;
09fd0de5bd8f8e Gustavo Padovan 2011-06-17 988 hci_dev_unlock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 989 out:
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 990 release_sock(sk);
5e762444b0d3e5 Antti Julku 2011-08-25 991
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 992 if (!err)
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 993 err = copy_to_user(arg, &req, sizeof(req)) ? -EFAULT : 0;
5e762444b0d3e5 Antti Julku 2011-08-25 994 return err;
f03585689fdff4 Johan Hedberg 2010-05-18 995 }
f03585689fdff4 Johan Hedberg 2010-05-18 996
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 997 static int hci_sock_reject_list_add(struct sock *sk, void __user *arg)
f03585689fdff4 Johan Hedberg 2010-05-18 998 {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 999 struct hci_dev *hdev;
f03585689fdff4 Johan Hedberg 2010-05-18 1000 bdaddr_t bdaddr;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1001 int err = 0;
f03585689fdff4 Johan Hedberg 2010-05-18 1002
f03585689fdff4 Johan Hedberg 2010-05-18 1003 if (copy_from_user(&bdaddr, arg, sizeof(bdaddr)))
f03585689fdff4 Johan Hedberg 2010-05-18 1004 return -EFAULT;
f03585689fdff4 Johan Hedberg 2010-05-18 1005
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1006 lock_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1007 hdev = validate_hdev_from_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1008 if (IS_ERR(hdev)) {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 @1009 err = PTR_ERR(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1010 goto out;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1011 } else if (!capable(CAP_NET_ADMIN)) {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1012 err = -EPERM;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1013 goto out;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1014 }
09fd0de5bd8f8e Gustavo Padovan 2011-06-17 1015 hci_dev_lock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1016 err = hci_bdaddr_list_add(&hdev->reject_list, &bdaddr, BDADDR_BREDR);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1017 hci_dev_unlock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1018 out:
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1019 release_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1020 return err;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1021 }
5e762444b0d3e5 Antti Julku 2011-08-25 1022
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1023 static int hci_sock_reject_list_del(struct sock *sk, void __user *arg)
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1024 {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1025 struct hci_dev *hdev;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1026 bdaddr_t bdaddr;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1027 int err = 0;
5e762444b0d3e5 Antti Julku 2011-08-25 1028
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1029 if (copy_from_user(&bdaddr, arg, sizeof(bdaddr)))
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1030 return -EFAULT;
5e762444b0d3e5 Antti Julku 2011-08-25 1031
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1032 lock_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1033 hdev = validate_hdev_from_sock(sk);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1034 if (IS_ERR(hdev)) {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 @1035 err = PTR_ERR(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1036 goto out;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1037 } else if (!capable(CAP_NET_ADMIN)) {
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1038 err = -EPERM;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1039 goto out;
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1040 }
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1041 hci_dev_lock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1042 err = hci_bdaddr_list_del(&hdev->reject_list, &bdaddr, BDADDR_BREDR);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1043 hci_dev_unlock(hdev);
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1044 out:
e66f8c795ca2e6 Tetsuo Handa 2021-07-31 1045 release_sock(sk);
5e762444b0d3e5 Antti Julku 2011-08-25 1046 return err;
f03585689fdff4 Johan Hedberg 2010-05-18 1047 }
f03585689fdff4 Johan Hedberg 2010-05-18 1048
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
drivers/block/null_blk/main.c:1885:2: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Damien Le Moal <damien.lemoal(a)wdc.com>
CC: Jens Axboe <axboe(a)kernel.dk>
CC: Johannes Thumshirn <johannes.thumshirn(a)wdc.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c7d102232649226a69dddd58a4942cf13cff4f7c
commit: eebf34a85c8c724676eba502d15202854f199b05 null_blk: Move driver into its own directory
date: 8 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 8 months ago
compiler: powerpc-linux-gcc (GCC) 10.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/block/null_blk/main.c:1885:2: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
sprintf(nullb->disk_name, "nullb%d", nullb->index);
^
vim +1885 drivers/block/null_blk/main.c
93b570464cce007 drivers/block/null_blk.c Jens Axboe 2018-01-10 1794
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1795 static int null_add_dev(struct nullb_device *dev)
9ae2d0aa5046c67 drivers/block/null_blk.c Matias Bjørling 2016-09-16 1796 {
9ae2d0aa5046c67 drivers/block/null_blk.c Matias Bjørling 2016-09-16 1797 struct nullb *nullb;
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1798 int rv;
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1799
5c4bd1f40c23d08 drivers/block/null_blk_main.c Damien Le Moal 2019-12-03 1800 rv = null_validate_conf(dev);
5c4bd1f40c23d08 drivers/block/null_blk_main.c Damien Le Moal 2019-12-03 1801 if (rv)
5c4bd1f40c23d08 drivers/block/null_blk_main.c Damien Le Moal 2019-12-03 1802 return rv;
cedcafad8277b3a drivers/block/null_blk.c Shaohua Li 2017-08-14 1803
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1804 nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, dev->home_node);
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1805 if (!nullb) {
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1806 rv = -ENOMEM;
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1807 goto out;
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1808 }
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1809 nullb->dev = dev;
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1810 dev->nullb = nullb;
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1811
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1812 spin_lock_init(&nullb->lock);
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1813
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1814 rv = setup_queues(nullb);
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1815 if (rv)
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1816 goto out_free_nullb;
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1817
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1818 if (dev->queue_mode == NULL_Q_MQ) {
82f402fefa50f16 drivers/block/null_blk.c Jens Axboe 2017-06-20 1819 if (shared_tags) {
82f402fefa50f16 drivers/block/null_blk.c Jens Axboe 2017-06-20 1820 nullb->tag_set = &tag_set;
82f402fefa50f16 drivers/block/null_blk.c Jens Axboe 2017-06-20 1821 rv = 0;
82f402fefa50f16 drivers/block/null_blk.c Jens Axboe 2017-06-20 1822 } else {
82f402fefa50f16 drivers/block/null_blk.c Jens Axboe 2017-06-20 1823 nullb->tag_set = &nullb->__tag_set;
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1824 rv = null_init_tag_set(nullb, nullb->tag_set);
82f402fefa50f16 drivers/block/null_blk.c Jens Axboe 2017-06-20 1825 }
db5bcf87bb9e856 drivers/block/null_blk.c Jens Axboe 2017-03-30 1826
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1827 if (rv)
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1828 goto out_cleanup_queues;
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1829
93b570464cce007 drivers/block/null_blk.c Jens Axboe 2018-01-10 1830 if (!null_setup_fault())
93b570464cce007 drivers/block/null_blk.c Jens Axboe 2018-01-10 1831 goto out_cleanup_queues;
93b570464cce007 drivers/block/null_blk.c Jens Axboe 2018-01-10 1832
5448aca41cd58e1 drivers/block/null_blk.c Jens Axboe 2018-01-09 1833 nullb->tag_set->timeout = 5 * HZ;
8d96a1117c21faa drivers/block/null_blk_main.c Christoph Hellwig 2020-03-27 1834 nullb->q = blk_mq_init_queue_data(nullb->tag_set, nullb);
35b489d32fcc37e drivers/block/null_blk.c Ming Lei 2015-01-02 1835 if (IS_ERR(nullb->q)) {
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1836 rv = -ENOMEM;
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1837 goto out_cleanup_tags;
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1838 }
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1839 } else if (dev->queue_mode == NULL_Q_BIO) {
c62b37d96b6eb3e drivers/block/null_blk_main.c Christoph Hellwig 2020-07-01 1840 nullb->q = blk_alloc_queue(dev->home_node);
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1841 if (!nullb->q) {
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1842 rv = -ENOMEM;
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1843 goto out_cleanup_queues;
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1844 }
31f9690e6eaf549 drivers/block/null_blk.c Jan Kara 2014-10-22 1845 rv = init_driver_queues(nullb);
31f9690e6eaf549 drivers/block/null_blk.c Jan Kara 2014-10-22 1846 if (rv)
31f9690e6eaf549 drivers/block/null_blk.c Jan Kara 2014-10-22 1847 goto out_cleanup_blk_queue;
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1848 }
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1849
eff2c4f108735dd drivers/block/null_blk.c Shaohua Li 2017-08-14 1850 if (dev->mbps) {
eff2c4f108735dd drivers/block/null_blk.c Shaohua Li 2017-08-14 1851 set_bit(NULLB_DEV_FL_THROTTLED, &dev->flags);
eff2c4f108735dd drivers/block/null_blk.c Shaohua Li 2017-08-14 1852 nullb_setup_bwtimer(nullb);
eff2c4f108735dd drivers/block/null_blk.c Shaohua Li 2017-08-14 1853 }
eff2c4f108735dd drivers/block/null_blk.c Shaohua Li 2017-08-14 1854
deb78b419dfda33 drivers/block/null_blk.c Shaohua Li 2017-08-14 1855 if (dev->cache_size > 0) {
deb78b419dfda33 drivers/block/null_blk.c Shaohua Li 2017-08-14 1856 set_bit(NULLB_DEV_FL_CACHE, &nullb->dev->flags);
deb78b419dfda33 drivers/block/null_blk.c Shaohua Li 2017-08-14 1857 blk_queue_write_cache(nullb->q, true, true);
deb78b419dfda33 drivers/block/null_blk.c Shaohua Li 2017-08-14 1858 }
deb78b419dfda33 drivers/block/null_blk.c Shaohua Li 2017-08-14 1859
ca4b2a011948fae drivers/block/null_blk.c Matias Bjørling 2018-07-06 1860 if (dev->zoned) {
d205bde78fa53e1 drivers/block/null_blk_main.c Damien Le Moal 2020-04-23 1861 rv = null_init_zoned_dev(dev, nullb->q);
ca4b2a011948fae drivers/block/null_blk.c Matias Bjørling 2018-07-06 1862 if (rv)
ca4b2a011948fae drivers/block/null_blk.c Matias Bjørling 2018-07-06 1863 goto out_cleanup_blk_queue;
ca4b2a011948fae drivers/block/null_blk.c Matias Bjørling 2018-07-06 1864 }
ca4b2a011948fae drivers/block/null_blk.c Matias Bjørling 2018-07-06 1865
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1866 nullb->q->queuedata = nullb;
8b904b5b6b58b9a drivers/block/null_blk.c Bart Van Assche 2018-03-07 1867 blk_queue_flag_set(QUEUE_FLAG_NONROT, nullb->q);
8b904b5b6b58b9a drivers/block/null_blk.c Bart Van Assche 2018-03-07 1868 blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q);
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1869
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1870 mutex_lock(&lock);
94bc02e30fb8d04 drivers/block/null_blk.c Shaohua Li 2017-08-14 1871 nullb->index = ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL);
cedcafad8277b3a drivers/block/null_blk.c Shaohua Li 2017-08-14 1872 dev->index = nullb->index;
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1873 mutex_unlock(&lock);
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1874
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1875 blk_queue_logical_block_size(nullb->q, dev->blocksize);
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1876 blk_queue_physical_block_size(nullb->q, dev->blocksize);
ea17fd354ca8afd drivers/block/null_blk_main.c Damien Le Moal 2020-11-20 1877 if (!dev->max_sectors)
ea17fd354ca8afd drivers/block/null_blk_main.c Damien Le Moal 2020-11-20 1878 dev->max_sectors = queue_max_hw_sectors(nullb->q);
ea17fd354ca8afd drivers/block/null_blk_main.c Damien Le Moal 2020-11-20 1879 dev->max_sectors = min_t(unsigned int, dev->max_sectors,
ea17fd354ca8afd drivers/block/null_blk_main.c Damien Le Moal 2020-11-20 1880 BLK_DEF_MAX_SECTORS);
ea17fd354ca8afd drivers/block/null_blk_main.c Damien Le Moal 2020-11-20 1881 blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1882
306eb6b4ad4f2d5 drivers/block/null_blk.c Shaohua Li 2017-08-14 1883 null_config_discard(nullb);
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1884
b2b7e00148a203e drivers/block/null_blk.c Matias Bjørling 2015-11-12 @1885 sprintf(nullb->disk_name, "nullb%d", nullb->index);
b2b7e00148a203e drivers/block/null_blk.c Matias Bjørling 2015-11-12 1886
9ae2d0aa5046c67 drivers/block/null_blk.c Matias Bjørling 2016-09-16 1887 rv = null_gendisk_register(nullb);
b2b7e00148a203e drivers/block/null_blk.c Matias Bjørling 2015-11-12 1888 if (rv)
ca4b2a011948fae drivers/block/null_blk.c Matias Bjørling 2018-07-06 1889 goto out_cleanup_zone;
b2b7e00148a203e drivers/block/null_blk.c Matias Bjørling 2015-11-12 1890
a514379b0c77085 drivers/block/null_blk.c Matias Bjørling 2016-02-11 1891 mutex_lock(&lock);
a514379b0c77085 drivers/block/null_blk.c Matias Bjørling 2016-02-11 1892 list_add_tail(&nullb->list, &nullb_list);
a514379b0c77085 drivers/block/null_blk.c Matias Bjørling 2016-02-11 1893 mutex_unlock(&lock);
3681c85dffda70e drivers/block/null_blk.c Wenwei Tao 2016-03-05 1894
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1895 return 0;
ca4b2a011948fae drivers/block/null_blk.c Matias Bjørling 2018-07-06 1896 out_cleanup_zone:
d205bde78fa53e1 drivers/block/null_blk_main.c Damien Le Moal 2020-04-23 1897 null_free_zoned_dev(dev);
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1898 out_cleanup_blk_queue:
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1899 blk_cleanup_queue(nullb->q);
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1900 out_cleanup_tags:
2984c8684f962c2 drivers/block/null_blk.c Shaohua Li 2017-08-14 1901 if (dev->queue_mode == NULL_Q_MQ && nullb->tag_set == &nullb->__tag_set)
82f402fefa50f16 drivers/block/null_blk.c Jens Axboe 2017-06-20 1902 blk_mq_free_tag_set(nullb->tag_set);
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1903 out_cleanup_queues:
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1904 cleanup_queues(nullb);
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1905 out_free_nullb:
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1906 kfree(nullb);
2004bfdef945fe5 drivers/block/null_blk_main.c Bart Van Assche 2020-03-09 1907 dev->nullb = NULL;
24d2f90309b23f2 drivers/block/null_blk.c Christoph Hellwig 2014-04-15 1908 out:
dc501dc0d9dc9cb drivers/block/null_blk.c Robert Elliott 2014-09-02 1909 return rv;
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1910 }
f2298c0403b0dfc drivers/block/null_blk.c Jens Axboe 2013-10-25 1911
:::::: The code at line 1885 was first introduced by commit
:::::: b2b7e00148a203e9934bbd17aebffae3f447ade7 null_blk: register as a LightNVM device
:::::: TO: Matias Bjørling <m(a)bjorling.me>
:::::: CC: Jens Axboe <axboe(a)fb.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[plbossart-sound:fix/glk-chuwi-Hi10x 4/7] sound/soc/codecs/es8316.h:95:9: sparse: this was the original definition
by kernel test robot
CC: kbuild-all(a)lists.01.org
TO: "Pierre-Louis Bossart" <pierre-louis.bossart(a)linux.intel.com>
tree: https://github.com/plbossart/sound fix/glk-chuwi-Hi10x
head: 8d2c8b66245b0b2c8c3d4b8a8a7b890b469277d0
commit: aa983d82765d8f1f797f33d2ae1ac1b7272cac02 [4/7] [HACK][FOR FOR UPSTREAM] es8336 support
:::::: branch date: 12 hours ago
:::::: commit date: 15 hours ago
config: i386-randconfig-s032-20210730 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/plbossart/sound/commit/aa983d82765d8f1f797f33d2ae1ac1b...
git remote add plbossart-sound https://github.com/plbossart/sound
git fetch --no-tags plbossart-sound fix/glk-chuwi-Hi10x
git checkout aa983d82765d8f1f797f33d2ae1ac1b7272cac02
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash sound/soc/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
sound/soc/codecs/es8316.c: note: in included file:
sound/soc/codecs/es8316.h:225:9: sparse: sparse: preprocessor token ES8316_GPIO_FLAG redefined
>> sound/soc/codecs/es8316.h:95:9: sparse: this was the original definition
>> sound/soc/codecs/es8316.c:638:21: sparse: sparse: assignment expression in conditional
vim +95 sound/soc/codecs/es8316.h
b8b88b70875af7 Daniel Drake 2017-06-12 10
b8b88b70875af7 Daniel Drake 2017-06-12 11 /*
b8b88b70875af7 Daniel Drake 2017-06-12 12 * ES8316 register space
b8b88b70875af7 Daniel Drake 2017-06-12 13 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 14 #define ES8316_RESET_REG00 0x00
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 15 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 16 * Clock Managerment
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 17 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 18 #define ES8316_CLKMGR_CLKSW_REG01 0x01
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 19 #define ES8316_CLKMGR_CLKSEL_REG02 0x02
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 20 #define ES8316_CLKMGR_ADCOSR_REG03 0x03
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 21 #define ES8316_CLKMGR_ADCDIV1_REG04 0x04
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 22 #define ES8316_CLKMGR_ADCDIV2_REG05 0x05
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 23 #define ES8316_CLKMGR_DACDIV1_REG06 0x06
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 24 #define ES8316_CLKMGR_DACDIV2_REG07 0x07
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 25 #define ES8316_CLKMGR_CPDIV_REG08 0x08
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 26 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 27 * SDP Control
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 28 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 29 #define ES8316_SDP_MS_BCKDIV_REG09 0x09
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 30 #define ES8316_SDP_ADCFMT_REG0A 0x0a
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 31 #define ES8316_SDP_DACFMT_REG0B 0x0b
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 32 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 33 * System Control
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 34 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 35 #define ES8316_SYS_VMIDSEL_REG0C 0x0c
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 36 #define ES8316_SYS_PDN_REG0D 0x0d
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 37 #define ES8316_SYS_LP1_REG0E 0x0e
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 38 #define ES8316_SYS_LP2_REG0F 0x0f
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 39 #define ES8316_SYS_VMIDLOW_REG10 0x10
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 40 #define ES8316_SYS_VSEL_REG11 0x11
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 41 #define ES8316_SYS_REF_REG12 0x12
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 42 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 43 * HP Mixer
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 44 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 45 #define ES8316_HPMIX_SEL_REG13 0x13
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 46 #define ES8316_HPMIX_SWITCH_REG14 0x14
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 47 #define ES8316_HPMIX_PDN_REG15 0x15
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 48 #define ES8316_HPMIX_VOL_REG16 0x16
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 49 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 50 * Charge Pump Headphone driver
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 51 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 52 #define ES8316_CPHP_OUTEN_REG17 0x17
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 53 #define ES8316_CPHP_ICAL_VOL_REG18 0x18
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 54 #define ES8316_CPHP_PDN1_REG19 0x19
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 55 #define ES8316_CPHP_PDN2_REG1A 0x1a
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 56 #define ES8316_CPHP_LDOCTL_REG1B 0x1b
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 57 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 58 * Calibration
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 59 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 60 #define ES8316_CAL_TYPE_REG1C 0x1c
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 61 #define ES8316_CAL_SET_REG1D 0x1d
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 62 #define ES8316_CAL_HPLIV_REG1E 0x1e
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 63 #define ES8316_CAL_HPRIV_REG1F 0x1f
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 64 #define ES8316_CAL_HPLMV_REG20 0x20
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 65 #define ES8316_CAL_HPRMV_REG21 0x21
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 66 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 67 * ADC Control
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 68 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 69 #define ES8316_ADC_PDN_LINSEL_REG22 0x22
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 70 #define ES8316_ADC_PGAGAIN_REG23 0x23
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 71 #define ES8316_ADC_D2SEPGA_REG24 0x24
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 72 #define ES8316_ADC_DMIC_REG25 0x25
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 73 #define ES8316_ADC_MUTE_REG26 0x26
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 74 #define ES8316_ADC_VOLUME_REG27 0x27
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 75 #define ES8316_ADC_ALC1_REG29 0x29
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 76 #define ES8316_ADC_ALC2_REG2A 0x2a
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 77 #define ES8316_ADC_ALC3_REG2B 0x2b
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 78 #define ES8316_ADC_ALC4_REG2C 0x2c
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 79 #define ES8316_ADC_ALC5_REG2D 0x2d
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 80 #define ES8316_ADC_ALC6_REG2E 0x2e
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 81 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 82 * DAC Control
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 83 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 84 #define ES8316_DAC_PDN_REG2F 0x2f
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 85 #define ES8316_DAC_SET1_REG30 0x30
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 86 #define ES8316_DAC_SET2_REG31 0x31
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 87 #define ES8316_DAC_SET3_REG32 0x32
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 88 #define ES8316_DAC_VOLL_REG33 0x33
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 89 #define ES8316_DAC_VOLR_REG34 0x34
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 90 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 91 * GPIO
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 92 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 93 #define ES8316_GPIO_SEL_REG4D 0x4D
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 94 #define ES8316_GPIO_DEBUNCE_INT_REG4E 0x4E
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 @95 #define ES8316_GPIO_FLAG 0x4F
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 96 /*
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 97 * TEST MODE
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 98 */
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 99 #define ES8316_TESTMODE_REG50 0x50
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 100 #define ES8316_TEST1_REG51 0x51
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 101 #define ES8316_TEST2_REG52 0x52
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 102 #define ES8316_TEST3_REG53 0x53
aa983d82765d8f Pierre-Louis Bossart 2021-07-30 103
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
[linux-next:master 3772/4668] fs/btrfs/lzo.c:382:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
by kernel test robot
CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Qu Wenruo <wqu(a)suse.com>
CC: David Sterba <dsterba(a)suse.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 8d4b477da1a807199ca60e0829357ce7aa6758d5
commit: a3044f3fb1b552c15aa143dd089d3a03d6371d64 [3772/4668] btrfs: rework lzo_decompress_bio() to make it subpage compatible
:::::: branch date: 5 hours ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-c001-20210729 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c49df15c278857adecd12db6bb1cdc96885f7079)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout a3044f3fb1b552c15aa143dd089d3a03d6371d64
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/asihpi/hpi6205.c:388:2: note: Taking false branch
HPI_DEBUG_LOG(VERBOSE, "start of switch\n");
^
sound/pci/asihpi/hpidebug.h:47:3: note: expanded from macro 'HPI_DEBUG_LOG'
if (hpi_debug_level >= HPI_DEBUG_LEVEL_##level) { \
^
sound/pci/asihpi/hpi6205.c:388:2: note: Loop condition is false. Exiting loop
HPI_DEBUG_LOG(VERBOSE, "start of switch\n");
^
sound/pci/asihpi/hpidebug.h:46:2: note: expanded from macro 'HPI_DEBUG_LOG'
do { \
^
sound/pci/asihpi/hpi6205.c:389:2: note: Control jumps to 'case HPI_TYPE_REQUEST:' at line 390
switch (phm->type) {
^
sound/pci/asihpi/hpi6205.c:391:3: note: Control jumps to the 'default' case at line 412
switch (phm->object) {
^
sound/pci/asihpi/hpi6205.c:413:4: note: Calling 'hw_message'
hw_message(pao, phm, phr);
^~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/asihpi/hpi6205.c:2174:2: note: Calling 'cond_lock'
hpios_dsplock_lock(pao);
^
sound/pci/asihpi/hpios.h:124:36: note: expanded from macro 'hpios_dsplock_lock'
#define hpios_dsplock_lock(obj) cond_lock(&(obj)->dsp_lock)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/asihpi/hpios.h:99:6: note: Calling 'arch_local_save_flags'
if (irqs_disabled()) {
^
include/linux/irqflags.h:254:3: note: expanded from macro 'irqs_disabled'
raw_local_save_flags(_flags); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/irqflags.h:182:11: note: expanded from macro 'raw_local_save_flags'
flags = arch_local_save_flags(); \
^~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/paravirt.h:683:9: note: Assigned value is garbage or undefined
return PVOP_ALT_CALLEE0(unsigned long, irq.save_fl, "pushf; pop %%rax;",
^
arch/x86/include/asm/paravirt_types.h:522:2: note: expanded from macro 'PVOP_ALT_CALLEE0'
__PVOP_ALT_CALLEESAVE(rettype, op, alt, cond)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/paravirt_types.h:486:2: note: expanded from macro '__PVOP_ALT_CALLEESAVE'
____PVOP_ALT_CALL(PVOP_RETVAL(rettype), op.func, alt, cond, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/paravirt_types.h:460:3: note: expanded from macro '____PVOP_ALT_CALL'
PVOP_CALL_ARGS; \
^~~~~~~~~~~~~~
arch/x86/include/asm/paravirt_types.h:404:16: note: expanded from macro 'PVOP_CALL_ARGS'
unsigned long __edi = __edi, __esi = __esi, \
^ ~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
sound/firewire/fireface/ff.c:31:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(ff->card->shortname, name);
^~~~~~
sound/firewire/fireface/ff.c:31:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(ff->card->shortname, name);
^~~~~~
sound/firewire/fireface/ff.c:32:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(ff->card->mixername, name);
^~~~~~
sound/firewire/fireface/ff.c:32:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(ff->card->mixername, name);
^~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
sound/firewire/fireface/ff-hwdep.c:181:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(hwdep->name, ff->card->driver);
^~~~~~
sound/firewire/fireface/ff-hwdep.c:181:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(hwdep->name, ff->card->driver);
^~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
>> fs/btrfs/lzo.c:382:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
if (!ret)
^~~~
fs/btrfs/lzo.c:303:32: note: Left side of '&&' is false
struct workspace *workspace = list_entry(ws, struct workspace, list);
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
fs/btrfs/lzo.c:303:32: note: Taking false branch
struct workspace *workspace = list_entry(ws, struct workspace, list);
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
fs/btrfs/lzo.c:303:32: note: Loop condition is false. Exiting loop
struct workspace *workspace = list_entry(ws, struct workspace, list);
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
fs/btrfs/lzo.c:306:2: note: 'ret' declared without an initial value
int ret;
^~~~~~~
fs/btrfs/lzo.c:324:15: note: Assuming '__UNIQUE_ID___x2408' is >= '__UNIQUE_ID___y2409'
if (len_in > min_t(size_t, BTRFS_MAX_COMPRESSED, cb->compressed_len) ||
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^~~~~~~~~~
fs/btrfs/lzo.c:324:15: note: '?' condition is false
if (len_in > min_t(size_t, BTRFS_MAX_COMPRESSED, cb->compressed_len) ||
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
fs/btrfs/lzo.c:324:6: note: Assuming the condition is false
if (len_in > min_t(size_t, BTRFS_MAX_COMPRESSED, cb->compressed_len) ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/lzo.c:324:6: note: Left side of '||' is false
fs/btrfs/lzo.c:325:6: note: Assuming the condition is false
round_up(len_in, sectorsize) < cb->compressed_len) {
^
include/linux/math.h:24:24: note: expanded from macro 'round_up'
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
^
fs/btrfs/lzo.c:324:2: note: Taking false branch
if (len_in > min_t(size_t, BTRFS_MAX_COMPRESSED, cb->compressed_len) ||
^
fs/btrfs/lzo.c:333:9: note: Assuming 'cur_in' is >= 'len_in'
vim +382 fs/btrfs/lzo.c
a6fa6fae40ec33 Li Zefan 2010-10-25 300
a3044f3fb1b552 Qu Wenruo 2021-07-26 301 int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb)
a3044f3fb1b552 Qu Wenruo 2021-07-26 302 {
a3044f3fb1b552 Qu Wenruo 2021-07-26 303 struct workspace *workspace = list_entry(ws, struct workspace, list);
a3044f3fb1b552 Qu Wenruo 2021-07-26 304 const struct btrfs_fs_info *fs_info = btrfs_sb(cb->inode->i_sb);
a3044f3fb1b552 Qu Wenruo 2021-07-26 305 const u32 sectorsize = fs_info->sectorsize;
a3044f3fb1b552 Qu Wenruo 2021-07-26 306 int ret;
a3044f3fb1b552 Qu Wenruo 2021-07-26 307 /* Compressed data length, can be unaligned */
a3044f3fb1b552 Qu Wenruo 2021-07-26 308 u32 len_in;
a3044f3fb1b552 Qu Wenruo 2021-07-26 309 /* Offset inside the compressed data */
a3044f3fb1b552 Qu Wenruo 2021-07-26 310 u32 cur_in = 0;
a3044f3fb1b552 Qu Wenruo 2021-07-26 311 /* Bytes decompressed so far */
a3044f3fb1b552 Qu Wenruo 2021-07-26 312 u32 cur_out = 0;
a3044f3fb1b552 Qu Wenruo 2021-07-26 313
a3044f3fb1b552 Qu Wenruo 2021-07-26 314 len_in = read_compress_length(page_address(cb->compressed_pages[0]));
a3044f3fb1b552 Qu Wenruo 2021-07-26 315 cur_in += LZO_LEN;
a6fa6fae40ec33 Li Zefan 2010-10-25 316
a3044f3fb1b552 Qu Wenruo 2021-07-26 317 /*
a3044f3fb1b552 Qu Wenruo 2021-07-26 318 * LZO header length check
a3044f3fb1b552 Qu Wenruo 2021-07-26 319 *
a3044f3fb1b552 Qu Wenruo 2021-07-26 320 * The total length should not exceed the maximum extent length,
a3044f3fb1b552 Qu Wenruo 2021-07-26 321 * and all sectors should be used.
a3044f3fb1b552 Qu Wenruo 2021-07-26 322 * If this happens, it means the compressed extent is corrupted.
a3044f3fb1b552 Qu Wenruo 2021-07-26 323 */
a3044f3fb1b552 Qu Wenruo 2021-07-26 324 if (len_in > min_t(size_t, BTRFS_MAX_COMPRESSED, cb->compressed_len) ||
a3044f3fb1b552 Qu Wenruo 2021-07-26 325 round_up(len_in, sectorsize) < cb->compressed_len) {
a3044f3fb1b552 Qu Wenruo 2021-07-26 326 btrfs_err(fs_info,
a3044f3fb1b552 Qu Wenruo 2021-07-26 327 "invalid lzo header, lzo len %u compressed len %u",
a3044f3fb1b552 Qu Wenruo 2021-07-26 328 len_in, cb->compressed_len);
a3044f3fb1b552 Qu Wenruo 2021-07-26 329 return -EUCLEAN;
a6fa6fae40ec33 Li Zefan 2010-10-25 330 }
ca9b688c1c9a21 Li Zefan 2011-02-16 331
a3044f3fb1b552 Qu Wenruo 2021-07-26 332 /* Go through each lzo segment */
a3044f3fb1b552 Qu Wenruo 2021-07-26 333 while (cur_in < len_in) {
a3044f3fb1b552 Qu Wenruo 2021-07-26 334 struct page *cur_page;
a3044f3fb1b552 Qu Wenruo 2021-07-26 335 /* Length of the compressed segment */
a3044f3fb1b552 Qu Wenruo 2021-07-26 336 u32 seg_len;
a3044f3fb1b552 Qu Wenruo 2021-07-26 337 u32 sector_bytes_left;
a3044f3fb1b552 Qu Wenruo 2021-07-26 338 size_t out_len = lzo1x_worst_compress(sectorsize);
a6fa6fae40ec33 Li Zefan 2010-10-25 339
a3044f3fb1b552 Qu Wenruo 2021-07-26 340 /*
a3044f3fb1b552 Qu Wenruo 2021-07-26 341 * We should always have enough space for one segment header
a3044f3fb1b552 Qu Wenruo 2021-07-26 342 * inside current sector.
a3044f3fb1b552 Qu Wenruo 2021-07-26 343 */
a3044f3fb1b552 Qu Wenruo 2021-07-26 344 ASSERT(cur_in / sectorsize ==
a3044f3fb1b552 Qu Wenruo 2021-07-26 345 (cur_in + LZO_LEN - 1) / sectorsize);
a3044f3fb1b552 Qu Wenruo 2021-07-26 346 cur_page = cb->compressed_pages[cur_in / PAGE_SIZE];
a3044f3fb1b552 Qu Wenruo 2021-07-26 347 ASSERT(cur_page);
a3044f3fb1b552 Qu Wenruo 2021-07-26 348 seg_len = read_compress_length(page_address(cur_page) +
a3044f3fb1b552 Qu Wenruo 2021-07-26 349 offset_in_page(cur_in));
a3044f3fb1b552 Qu Wenruo 2021-07-26 350 cur_in += LZO_LEN;
a3044f3fb1b552 Qu Wenruo 2021-07-26 351
a3044f3fb1b552 Qu Wenruo 2021-07-26 352 /* Copy the compressed segment payload into workspace */
a3044f3fb1b552 Qu Wenruo 2021-07-26 353 copy_compressed_segment(cb, workspace->cbuf, seg_len, &cur_in);
a3044f3fb1b552 Qu Wenruo 2021-07-26 354
a3044f3fb1b552 Qu Wenruo 2021-07-26 355 /* Decompress the data */
a3044f3fb1b552 Qu Wenruo 2021-07-26 356 ret = lzo1x_decompress_safe(workspace->cbuf, seg_len,
a3044f3fb1b552 Qu Wenruo 2021-07-26 357 workspace->buf, &out_len);
a6fa6fae40ec33 Li Zefan 2010-10-25 358 if (ret != LZO_E_OK) {
a3044f3fb1b552 Qu Wenruo 2021-07-26 359 btrfs_err(fs_info, "failed to decompress");
60e1975acb48fc Zach Brown 2014-05-09 360 ret = -EIO;
a3044f3fb1b552 Qu Wenruo 2021-07-26 361 goto out;
a6fa6fae40ec33 Li Zefan 2010-10-25 362 }
a6fa6fae40ec33 Li Zefan 2010-10-25 363
a3044f3fb1b552 Qu Wenruo 2021-07-26 364 /* Copy the data into inode pages */
a3044f3fb1b552 Qu Wenruo 2021-07-26 365 ret = btrfs_decompress_buf2page(workspace->buf, out_len, cb, cur_out);
a3044f3fb1b552 Qu Wenruo 2021-07-26 366 cur_out += out_len;
a6fa6fae40ec33 Li Zefan 2010-10-25 367
a3044f3fb1b552 Qu Wenruo 2021-07-26 368 /* All data read, exit */
a3044f3fb1b552 Qu Wenruo 2021-07-26 369 if (ret == 0)
a3044f3fb1b552 Qu Wenruo 2021-07-26 370 goto out;
a3044f3fb1b552 Qu Wenruo 2021-07-26 371 ret = 0;
a3044f3fb1b552 Qu Wenruo 2021-07-26 372
a3044f3fb1b552 Qu Wenruo 2021-07-26 373 /* Check if the sector has enough space for a segment header */
a3044f3fb1b552 Qu Wenruo 2021-07-26 374 sector_bytes_left = sectorsize - (cur_in % sectorsize);
a3044f3fb1b552 Qu Wenruo 2021-07-26 375 if (sector_bytes_left >= LZO_LEN)
a3044f3fb1b552 Qu Wenruo 2021-07-26 376 continue;
a3044f3fb1b552 Qu Wenruo 2021-07-26 377
a3044f3fb1b552 Qu Wenruo 2021-07-26 378 /* Skip the padding zeros */
a3044f3fb1b552 Qu Wenruo 2021-07-26 379 cur_in += sector_bytes_left;
a6fa6fae40ec33 Li Zefan 2010-10-25 380 }
a3044f3fb1b552 Qu Wenruo 2021-07-26 381 out:
2f19cad94cee3c Chris Mason 2014-11-30 @382 if (!ret)
349a1afaaa6d83 Qu Wenruo 2021-07-05 383 zero_fill_bio(cb->orig_bio);
a6fa6fae40ec33 Li Zefan 2010-10-25 384 return ret;
a6fa6fae40ec33 Li Zefan 2010-10-25 385 }
a6fa6fae40ec33 Li Zefan 2010-10-25 386
:::::: The code at line 382 was first introduced by commit
:::::: 2f19cad94cee3c9bd52d0c9ca584ef506302fb7c btrfs: zero out left over bytes after processing compression streams
:::::: TO: Chris Mason <clm(a)fb.com>
:::::: CC: Linus Torvalds <torvalds(a)linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks
drivers/pinctrl/pinctrl-k210.c:970 k210_fpioa_probe() warn: 'pdata->clk' not released on lines: 962,968.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Damien Le Moal <damien.lemoal(a)wdc.com>
CC: Palmer Dabbelt <palmerdabbelt(a)google.com>
CC: Sean Anderson <seanga2(a)gmail.com>
CC: Linus Walleij <linus.walleij(a)linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 764a5bc89b12b82c18ce7ca5d7c1b10dd748a440
commit: d4c34d09ab03e1e631fe195ddf35365a1273be9c pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver
date: 5 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 5 months ago
config: riscv-randconfig-m031-20210730 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 10.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/pinctrl/pinctrl-k210.c:970 k210_fpioa_probe() warn: 'pdata->clk' not released on lines: 962,968.
vim +970 drivers/pinctrl/pinctrl-k210.c
d4c34d09ab03e1 Damien Le Moal 2021-01-12 924
d4c34d09ab03e1 Damien Le Moal 2021-01-12 925 static int k210_fpioa_probe(struct platform_device *pdev)
d4c34d09ab03e1 Damien Le Moal 2021-01-12 926 {
d4c34d09ab03e1 Damien Le Moal 2021-01-12 927 struct device *dev = &pdev->dev;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 928 struct device_node *np = dev->of_node;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 929 struct k210_fpioa_data *pdata;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 930 int ret;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 931
d4c34d09ab03e1 Damien Le Moal 2021-01-12 932 dev_info(dev, "K210 FPIOA pin controller\n");
d4c34d09ab03e1 Damien Le Moal 2021-01-12 933
d4c34d09ab03e1 Damien Le Moal 2021-01-12 934 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 935 if (!pdata)
d4c34d09ab03e1 Damien Le Moal 2021-01-12 936 return -ENOMEM;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 937
d4c34d09ab03e1 Damien Le Moal 2021-01-12 938 pdata->dev = dev;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 939 platform_set_drvdata(pdev, pdata);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 940
d4c34d09ab03e1 Damien Le Moal 2021-01-12 941 pdata->fpioa = devm_platform_ioremap_resource(pdev, 0);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 942 if (IS_ERR(pdata->fpioa))
d4c34d09ab03e1 Damien Le Moal 2021-01-12 943 return PTR_ERR(pdata->fpioa);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 944
d4c34d09ab03e1 Damien Le Moal 2021-01-12 945 pdata->clk = devm_clk_get(dev, "ref");
d4c34d09ab03e1 Damien Le Moal 2021-01-12 946 if (IS_ERR(pdata->clk))
d4c34d09ab03e1 Damien Le Moal 2021-01-12 947 return PTR_ERR(pdata->clk);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 948
d4c34d09ab03e1 Damien Le Moal 2021-01-12 949 ret = clk_prepare_enable(pdata->clk);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 950 if (ret)
d4c34d09ab03e1 Damien Le Moal 2021-01-12 951 return ret;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 952
d4c34d09ab03e1 Damien Le Moal 2021-01-12 953 pdata->pclk = devm_clk_get_optional(dev, "pclk");
d4c34d09ab03e1 Damien Le Moal 2021-01-12 954 if (!IS_ERR(pdata->pclk))
d4c34d09ab03e1 Damien Le Moal 2021-01-12 955 clk_prepare_enable(pdata->pclk);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 956
d4c34d09ab03e1 Damien Le Moal 2021-01-12 957 pdata->sysctl_map =
d4c34d09ab03e1 Damien Le Moal 2021-01-12 958 syscon_regmap_lookup_by_phandle_args(np,
d4c34d09ab03e1 Damien Le Moal 2021-01-12 959 "canaan,k210-sysctl-power",
d4c34d09ab03e1 Damien Le Moal 2021-01-12 960 1, &pdata->power_offset);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 961 if (IS_ERR(pdata->sysctl_map))
d4c34d09ab03e1 Damien Le Moal 2021-01-12 962 return PTR_ERR(pdata->sysctl_map);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 963
d4c34d09ab03e1 Damien Le Moal 2021-01-12 964 k210_fpioa_init_ties(pdata);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 965
d4c34d09ab03e1 Damien Le Moal 2021-01-12 966 pdata->pctl = pinctrl_register(&k210_pinctrl_desc, dev, (void *)pdata);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 967 if (IS_ERR(pdata->pctl))
d4c34d09ab03e1 Damien Le Moal 2021-01-12 968 return PTR_ERR(pdata->pctl);
d4c34d09ab03e1 Damien Le Moal 2021-01-12 969
d4c34d09ab03e1 Damien Le Moal 2021-01-12 @970 return 0;
d4c34d09ab03e1 Damien Le Moal 2021-01-12 971 }
d4c34d09ab03e1 Damien Le Moal 2021-01-12 972
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 3 weeks