linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [djwong-xfs:vectorized-scrub 70/303] fs/xfs/xfs_symlink.c:176:2: warning: Value stored to 'resblks' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-08-17 23:17 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-17 23:17 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: clang-built-linux, kbuild-all, Darrick J. Wong, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 16059 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git vectorized-scrub
head:   142ad7efefdd71fa40628c868530a9357c18ba27
commit: 76d00130dc943feaf66ea28353b9975a2f4213d1 [70/303] xfs: repair damaged symlinks
config: riscv-randconfig-c006-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=76d00130dc943feaf66ea28353b9975a2f4213d1
        git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
        git fetch --no-tags djwong-xfs vectorized-scrub
        git checkout 76d00130dc943feaf66ea28353b9975a2f4213d1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
           if (edge) {
           ^
   fs/btrfs/backref.h:314:3: note: Memory is released
                   kfree(edge);
                   ^~~~~~~~~~~
   fs/btrfs/backref.c:3093:3: note: Returning; memory was released
                   btrfs_backref_free_edge(cache, edge);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/backref.c:3099:7: note: Assuming the condition is false
                   if (list_empty(&lower->upper) &&
                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/backref.c:3099:33: note: Left side of '&&' is false
                   if (list_empty(&lower->upper) &&
                                                 ^
   fs/btrfs/backref.c:3103:7: note: Assuming the condition is true
                   if (!RB_EMPTY_NODE(&upper->rb_node))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/backref.c:3103:3: note: Taking true branch
                   if (!RB_EMPTY_NODE(&upper->rb_node))
                   ^
   fs/btrfs/backref.c:3104:4: note:  Execution continues on line 3086
                           continue;
                           ^
   fs/btrfs/backref.c:3086:2: note: Loop condition is true.  Entering loop body
           while (!list_empty(&cache->pending_edge)) {
           ^
   fs/btrfs/backref.c:3087:10: note: Left side of '&&' is false
                   edge = list_first_entry(&cache->pending_edge,
                          ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   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/backref.c:3087:10: note: Taking false branch
                   edge = list_first_entry(&cache->pending_edge,
                          ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   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) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   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/backref.c:3087:10: note: Loop condition is false.  Exiting loop
                   edge = list_first_entry(&cache->pending_edge,
                          ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   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) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   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/backref.c:3089:3: note: Calling 'list_del'
                   list_del(&edge->list[UPPER]);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:146:2: note: Calling '__list_del_entry'
           __list_del_entry(entry);
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:132:2: note: Taking false branch
           if (!__list_del_entry_valid(entry))
           ^
   include/linux/list.h:135:13: note: Use of memory after it is freed
           __list_del(entry->prev, entry->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.
   12 warnings generated.
   Suppressed 12 warnings (12 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.
   11 warnings generated.
>> fs/xfs/xfs_symlink.c:176:2: warning: Value stored to 'resblks' is never read [clang-analyzer-deadcode.DeadStores]
           resblks -= fs_blocks;
           ^          ~~~~~~~~~
   fs/xfs/xfs_symlink.c:176:2: note: Value stored to 'resblks' is never read
           resblks -= fs_blocks;
           ^          ~~~~~~~~~
   Suppressed 10 warnings (10 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.
   13 warnings generated.
   include/linux/completion.h:86:10: warning: Access to field 'done' results in a dereference of a null pointer (loaded from variable 'x') [clang-analyzer-core.NullDereference]
           x->done = 0;
                   ^
   fs/xfs/xfs_sysfs.c:686:25: note: Passing value via 1st parameter 'kobj'
           error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype,
                                  ^~~~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.c:686:10: note: Calling 'xfs_sysfs_init'
           error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:37:11: note: Assuming 'parent_kobj' is null
           parent = parent_kobj ? &parent_kobj->kobject : NULL;
                    ^~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:37:11: note: '?' condition is false
   fs/xfs/xfs_sysfs.h:38:18: note: Passing value via 1st parameter 'x'
           init_completion(&kobj->complete);
                           ^~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:38:2: note: Calling 'init_completion'
           init_completion(&kobj->complete);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/completion.h:86:10: note: Access to field 'done' results in a dereference of a null pointer (loaded from variable 'x')
           x->done = 0;
           ~       ^
   Suppressed 12 warnings (12 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.
   Suppressed 12 warnings (12 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.
   Suppressed 10 warnings (10 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.
   7 warnings generated.
   Suppressed 7 warnings (7 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.
   Suppressed 6 warnings (6 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.
   Suppressed 6 warnings (6 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   Suppressed 6 warnings (6 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.
   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.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).

vim +/resblks +176 fs/xfs/xfs_symlink.c

   135	
   136	/* Write the symlink target into the inode. */
   137	int
   138	xfs_symlink_write_target(
   139		struct xfs_trans	*tp,
   140		struct xfs_inode	*ip,
   141		const char		*target_path,
   142		int			pathlen,
   143		xfs_fsblock_t		fs_blocks,
   144		uint			resblks)
   145	{
   146		struct xfs_bmbt_irec	mval[XFS_SYMLINK_MAPS];
   147		struct xfs_mount	*mp = tp->t_mountp;
   148		const char		*cur_chunk;
   149		struct xfs_buf		*bp;
   150		xfs_daddr_t		d;
   151		int			byte_cnt;
   152		int			nmaps;
   153		int			offset = 0;
   154		int			n;
   155		int			error;
   156	
   157		/*
   158		 * If the symlink will fit into the inode, write it inline.
   159		 */
   160		if (pathlen <= XFS_IFORK_DSIZE(ip)) {
   161			xfs_init_local_fork(ip, XFS_DATA_FORK, target_path, pathlen);
   162	
   163			ip->i_disk_size = pathlen;
   164			ip->i_df.if_format = XFS_DINODE_FMT_LOCAL;
   165			xfs_trans_log_inode(tp, ip, XFS_ILOG_DDATA | XFS_ILOG_CORE);
   166			i_size_write(VFS_I(ip), ip->i_disk_size);
   167			return 0;
   168		}
   169	
   170		nmaps = XFS_SYMLINK_MAPS;
   171		error = xfs_bmapi_write(tp, ip, 0, fs_blocks, XFS_BMAPI_METADATA,
   172				resblks, mval, &nmaps);
   173		if (error)
   174			return error;
   175	
 > 176		resblks -= fs_blocks;
   177		ip->i_disk_size = pathlen;
   178		xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
   179	
   180		cur_chunk = target_path;
   181		offset = 0;
   182		for (n = 0; n < nmaps; n++) {
   183			char	*buf;
   184	
   185			d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock);
   186			byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
   187			error = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
   188					BTOBB(byte_cnt), 0, &bp);
   189			if (error)
   190				return error;
   191			bp->b_ops = &xfs_symlink_buf_ops;
   192	
   193			byte_cnt = XFS_SYMLINK_BUF_SPACE(mp, byte_cnt);
   194			byte_cnt = min(byte_cnt, pathlen);
   195	
   196			buf = bp->b_addr;
   197			buf += xfs_symlink_hdr_set(mp, ip->i_ino, offset, byte_cnt,
   198					bp);
   199	
   200			memcpy(buf, cur_chunk, byte_cnt);
   201	
   202			cur_chunk += byte_cnt;
   203			pathlen -= byte_cnt;
   204			offset += byte_cnt;
   205	
   206			xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
   207			xfs_trans_log_buf(tp, bp, 0, (buf + byte_cnt - 1) -
   208							(char *)bp->b_addr);
   209		}
   210		ASSERT(pathlen == 0);
   211		i_size_write(VFS_I(ip), ip->i_disk_size);
   212		return 0;
   213	}
   214	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40902 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [djwong-xfs:vectorized-scrub 70/303] fs/xfs/xfs_symlink.c:176:2: warning: Value stored to 'resblks' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-08-23 11:06 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-23 11:06 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: clang-built-linux, kbuild-all, Darrick J. Wong, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 17597 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git vectorized-scrub
head:   142ad7efefdd71fa40628c868530a9357c18ba27
commit: 76d00130dc943feaf66ea28353b9975a2f4213d1 [70/303] xfs: repair damaged symlinks
config: riscv-randconfig-c006-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=76d00130dc943feaf66ea28353b9975a2f4213d1
        git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
        git fetch --no-tags djwong-xfs vectorized-scrub
        git checkout 76d00130dc943feaf66ea28353b9975a2f4213d1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   Suppressed 10 warnings (10 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.
   Suppressed 10 warnings (10 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.
   Suppressed 10 warnings (10 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.
   Suppressed 10 warnings (10 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.
   11 warnings generated.
   drivers/media/i2c/imx258.c:781:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                   ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/imx258.c:781:3: note: Value stored to 'ret' is never read
                   ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 10 warnings (10 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.
   Suppressed 10 warnings (10 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.
   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:713:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                           ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:713:4: note: Value stored to 'ret' is never read
                           ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:719:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                           ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:719:4: note: Value stored to 'ret' is never read
                           ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 10 warnings (10 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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/ntfs/runlist.c:1764:4: warning: Value stored to 'rl_end' is never read [clang-analyzer-deadcode.DeadStores]
                           rl_end = trl + (rl_end - runlist->rl);
                           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/runlist.c:1764:4: note: Value stored to 'rl_end' is never read
                           rl_end = trl + (rl_end - runlist->rl);
                           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/runlist.c:1834:4: warning: Value stored to 'rl_end' is never read [clang-analyzer-deadcode.DeadStores]
                           rl_end = trl + (rl_end - runlist->rl);
                           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/runlist.c:1834:4: note: Value stored to 'rl_end' is never read
                           rl_end = trl + (rl_end - runlist->rl);
                           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/runlist.c:1866:2: warning: Value stored to 'old_size' is never read [clang-analyzer-deadcode.DeadStores]
           old_size += 2;
           ^           ~
   fs/ntfs/runlist.c:1866:2: note: Value stored to 'old_size' is never read
           old_size += 2;
           ^           ~
   fs/ntfs/runlist.c:1869:3: warning: Value stored to 'rl_end' is never read [clang-analyzer-deadcode.DeadStores]
                   rl_end = trl + (rl_end - runlist->rl);
                   ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ntfs/runlist.c:1869:3: note: Value stored to 'rl_end' is never read
                   rl_end = trl + (rl_end - runlist->rl);
                   ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 8 warnings (8 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.
   Suppressed 10 warnings (10 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.
   7 warnings generated.
   Suppressed 7 warnings (7 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   11 warnings generated.
>> fs/xfs/xfs_symlink.c:176:2: warning: Value stored to 'resblks' is never read [clang-analyzer-deadcode.DeadStores]
           resblks -= fs_blocks;
           ^          ~~~~~~~~~
   fs/xfs/xfs_symlink.c:176:2: note: Value stored to 'resblks' is never read
           resblks -= fs_blocks;
           ^          ~~~~~~~~~
   Suppressed 10 warnings (10 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.
   13 warnings generated.
   include/linux/completion.h:86:10: warning: Access to field 'done' results in a dereference of a null pointer (loaded from variable 'x') [clang-analyzer-core.NullDereference]
           x->done = 0;
                   ^
   fs/xfs/xfs_sysfs.c:686:25: note: Passing value via 1st parameter 'kobj'
           error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype,
                                  ^~~~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.c:686:10: note: Calling 'xfs_sysfs_init'
           error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:37:11: note: Assuming 'parent_kobj' is null
           parent = parent_kobj ? &parent_kobj->kobject : NULL;
                    ^~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:37:11: note: '?' condition is false
   fs/xfs/xfs_sysfs.h:38:18: note: Passing value via 1st parameter 'x'
           init_completion(&kobj->complete);
                           ^~~~~~~~~~~~~~~
   fs/xfs/xfs_sysfs.h:38:2: note: Calling 'init_completion'
           init_completion(&kobj->complete);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/completion.h:86:10: note: Access to field 'done' results in a dereference of a null pointer (loaded from variable 'x')
           x->done = 0;
           ~       ^
   Suppressed 12 warnings (12 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.
   Suppressed 12 warnings (12 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.
   Suppressed 10 warnings (10 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.
   17 warnings generated.
   net/netfilter/nfnetlink_log.c:573:45: warning: Access to field 'type' results in a dereference of a null pointer (loaded from field 'dev') [clang-analyzer-core.NullDereference]
                   if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) ||
                                                             ^
   include/linux/byteorder/generic.h:141:18: note: expanded from macro 'htons'
   #define htons(x) ___htons(x)
                    ^        ~
   include/linux/byteorder/generic.h:135:21: note: expanded from macro '___htons'
   #define ___htons(x) __cpu_to_be16(x)
                       ^             ~
   include/uapi/linux/byteorder/little_endian.h:41:43: note: expanded from macro '__cpu_to_be16'
   #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
                                             ^         ~
   include/uapi/linux/swab.h:105:31: note: expanded from macro '__swab16'
           (__builtin_constant_p((__u16)(x)) ?     \
                                        ^~
   net/netfilter/nfnetlink_log.c:465:28: note: '?' condition is false
                              0, pf, NFNETLINK_V0, htons(inst->group_num));
                                                   ^
   include/linux/byteorder/generic.h:141:18: note: expanded from macro 'htons'
   #define htons(x) ___htons(x)
                    ^
   include/linux/byteorder/generic.h:135:21: note: expanded from macro '___htons'
   #define ___htons(x) __cpu_to_be16(x)
                       ^
   include/uapi/linux/byteorder/little_endian.h:41:43: note: expanded from macro '__cpu_to_be16'
   #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
                                             ^
   include/uapi/linux/swab.h:105:3: note: expanded from macro '__swab16'
           (__builtin_constant_p((__u16)(x)) ?     \
            ^
   net/netfilter/nfnetlink_log.c:463:8: note: Calling 'nfnl_msg_put'
           nlh = nfnl_msg_put(inst->skb, 0, 0,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/netfilter/nfnetlink.h:86:8: note: Calling 'nlmsg_put'
           nlh = nlmsg_put(skb, portid, seq, type, sizeof(struct nfgenmsg), flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/net/netlink.h:917:15: note: Assuming the condition is false
           if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload)))
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/net/netlink.h:917:2: note: Taking false branch
           if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload)))
           ^
   include/net/netlink.h:920:2: note: Returning pointer, which participates in a condition later
           return __nlmsg_put(skb, portid, seq, type, payload, flags);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/netfilter/nfnetlink.h:86:8: note: Returning from 'nlmsg_put'
           nlh = nlmsg_put(skb, portid, seq, type, sizeof(struct nfgenmsg), flags);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/netfilter/nfnetlink.h:87:6: note: Assuming 'nlh' is non-null, which participates in a condition later
           if (!nlh)
               ^~~~
   include/linux/netfilter/nfnetlink.h:87:2: note: Taking false branch
           if (!nlh)
           ^
   include/linux/netfilter/nfnetlink.h:92:2: note: Returning pointer (loaded from 'nlh'), which participates in a condition later

vim +/resblks +176 fs/xfs/xfs_symlink.c

   135	
   136	/* Write the symlink target into the inode. */
   137	int
   138	xfs_symlink_write_target(
   139		struct xfs_trans	*tp,
   140		struct xfs_inode	*ip,
   141		const char		*target_path,
   142		int			pathlen,
   143		xfs_fsblock_t		fs_blocks,
   144		uint			resblks)
   145	{
   146		struct xfs_bmbt_irec	mval[XFS_SYMLINK_MAPS];
   147		struct xfs_mount	*mp = tp->t_mountp;
   148		const char		*cur_chunk;
   149		struct xfs_buf		*bp;
   150		xfs_daddr_t		d;
   151		int			byte_cnt;
   152		int			nmaps;
   153		int			offset = 0;
   154		int			n;
   155		int			error;
   156	
   157		/*
   158		 * If the symlink will fit into the inode, write it inline.
   159		 */
   160		if (pathlen <= XFS_IFORK_DSIZE(ip)) {
   161			xfs_init_local_fork(ip, XFS_DATA_FORK, target_path, pathlen);
   162	
   163			ip->i_disk_size = pathlen;
   164			ip->i_df.if_format = XFS_DINODE_FMT_LOCAL;
   165			xfs_trans_log_inode(tp, ip, XFS_ILOG_DDATA | XFS_ILOG_CORE);
   166			i_size_write(VFS_I(ip), ip->i_disk_size);
   167			return 0;
   168		}
   169	
   170		nmaps = XFS_SYMLINK_MAPS;
   171		error = xfs_bmapi_write(tp, ip, 0, fs_blocks, XFS_BMAPI_METADATA,
   172				resblks, mval, &nmaps);
   173		if (error)
   174			return error;
   175	
 > 176		resblks -= fs_blocks;
   177		ip->i_disk_size = pathlen;
   178		xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
   179	
   180		cur_chunk = target_path;
   181		offset = 0;
   182		for (n = 0; n < nmaps; n++) {
   183			char	*buf;
   184	
   185			d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock);
   186			byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
   187			error = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
   188					BTOBB(byte_cnt), 0, &bp);
   189			if (error)
   190				return error;
   191			bp->b_ops = &xfs_symlink_buf_ops;
   192	
   193			byte_cnt = XFS_SYMLINK_BUF_SPACE(mp, byte_cnt);
   194			byte_cnt = min(byte_cnt, pathlen);
   195	
   196			buf = bp->b_addr;
   197			buf += xfs_symlink_hdr_set(mp, ip->i_ino, offset, byte_cnt,
   198					bp);
   199	
   200			memcpy(buf, cur_chunk, byte_cnt);
   201	
   202			cur_chunk += byte_cnt;
   203			pathlen -= byte_cnt;
   204			offset += byte_cnt;
   205	
   206			xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
   207			xfs_trans_log_buf(tp, bp, 0, (buf + byte_cnt - 1) -
   208							(char *)bp->b_addr);
   209		}
   210		ASSERT(pathlen == 0);
   211		i_size_write(VFS_I(ip), ip->i_disk_size);
   212		return 0;
   213	}
   214	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40901 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-23 11:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 23:17 [djwong-xfs:vectorized-scrub 70/303] fs/xfs/xfs_symlink.c:176:2: warning: Value stored to 'resblks' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
2021-08-23 11:06 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).