[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]

From: kernel test robot
Date: Mon Aug 23 2021 - 07:07:38 EST


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@xxxxxxxxx>


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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip