lkml.org 
[lkml]   [2021]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[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]
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
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-08-18 01:19    [W:0.455 / U:1.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site