[<prev] [next>] [day] [month] [year] [list]
Message-ID: <af19bca5-7ae6-afb7-6f2e-57c67fb6d9b4@intel.com>
Date: Mon, 21 Mar 2022 17:24:44 +0800
From: kernel test robot <yujie.liu@...el.com>
To: Amir Goldstein <amir73il@...il.com>
CC: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
<llvm@...ts.linux.dev>, <kbuild-all@...ts.01.org>
Subject: [amir73il:fsnotify-volatile 8/9]
fs/notify/fanotify/fanotify_user.c:1202:2: warning: Value stored to 'ret' is
never read [clang-analyzer-deadcode.DeadStores]
tree: https://github.com/amir73il/linux fsnotify-volatile
head: 20c431f640f13d125fa3d80fde9ae4a28892a029
commit: 068909e55d92d27d6c7e5688b4689235707613ba [8/9] fanotify: factor out helper fanotify_mark_update_flags()
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220321/202203211233.Vk5Tdqt8-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
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
# https://github.com/amir73il/linux/commit/068909e55d92d27d6c7e5688b4689235707613ba
git remote add amir73il https://github.com/amir73il/linux
git fetch --no-tags amir73il fsnotify-volatile
git checkout 068909e55d92d27d6c7e5688b4689235707613ba
# save the config file 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 <yujie.liu@...el.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> fs/notify/fanotify/fanotify_user.c:1202:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
vim +/ret +1202 fs/notify/fanotify/fanotify_user.c
5e9c070ca08543 Lino Sanfilippo 2013-07-08 1178
eaa2c6b0c9181c Amir Goldstein 2018-06-23 1179 static int fanotify_add_mark(struct fsnotify_group *group,
ad69cd9972e79a Amir Goldstein 2021-11-29 1180 fsnotify_connp_t *connp, unsigned int obj_type,
77115225acc67d Amir Goldstein 2019-01-10 1181 __u32 mask, unsigned int flags,
77115225acc67d Amir Goldstein 2019-01-10 1182 __kernel_fsid_t *fsid)
2a3edf86040a7e Eric Paris 2009-12-17 1183 {
40822e8f3f162d Amir Goldstein 2022-03-20 1184 struct fsnotify_mark *fsn_mark = NULL;
40822e8f3f162d Amir Goldstein 2022-03-20 1185 void *prealloc_conn = NULL, *prealloc_mark = NULL;
40822e8f3f162d Amir Goldstein 2022-03-20 1186 int ret = -ENOMEM;
40822e8f3f162d Amir Goldstein 2022-03-20 1187
40822e8f3f162d Amir Goldstein 2022-03-20 1188 fsn_mark = fsnotify_find_mark(connp, group);
40822e8f3f162d Amir Goldstein 2022-03-20 1189 /* Preallocate new mark and connector outside of group lock */
40822e8f3f162d Amir Goldstein 2022-03-20 1190 if (!fsn_mark) {
40822e8f3f162d Amir Goldstein 2022-03-20 1191 prealloc_conn = fsnotify_conn_alloc(GFP_KERNEL);
40822e8f3f162d Amir Goldstein 2022-03-20 1192 if (!prealloc_conn)
40822e8f3f162d Amir Goldstein 2022-03-20 1193 goto out;
40822e8f3f162d Amir Goldstein 2022-03-20 1194
40822e8f3f162d Amir Goldstein 2022-03-20 1195 prealloc_mark = kmem_cache_alloc(fanotify_mark_cache,
40822e8f3f162d Amir Goldstein 2022-03-20 1196 GFP_KERNEL);
40822e8f3f162d Amir Goldstein 2022-03-20 1197 if (!prealloc_mark)
40822e8f3f162d Amir Goldstein 2022-03-20 1198 goto out;
40822e8f3f162d Amir Goldstein 2022-03-20 1199 }
88826276dcaf4c Eric Paris 2009-12-17 1200
7b18527c4a9539 Lino Sanfilippo 2013-07-08 1201 mutex_lock(&group->mark_mutex);
40822e8f3f162d Amir Goldstein 2022-03-20 @1202 ret = 0;
40822e8f3f162d Amir Goldstein 2022-03-20 1203 /* Check again under lock - if found will not use preallocated mark */
40822e8f3f162d Amir Goldstein 2022-03-20 1204 if (!fsn_mark)
b812a9f5896379 Amir Goldstein 2018-06-23 1205 fsn_mark = fsnotify_find_mark(connp, group);
88826276dcaf4c Eric Paris 2009-12-17 1206 if (!fsn_mark) {
40822e8f3f162d Amir Goldstein 2022-03-20 1207 fsn_mark = fanotify_add_new_mark(group, connp, obj_type, fsid,
40822e8f3f162d Amir Goldstein 2022-03-20 1208 &prealloc_mark,
40822e8f3f162d Amir Goldstein 2022-03-20 1209 &prealloc_conn);
5e9c070ca08543 Lino Sanfilippo 2013-07-08 1210 if (IS_ERR(fsn_mark)) {
40822e8f3f162d Amir Goldstein 2022-03-20 1211 ret = PTR_ERR(fsn_mark);
40822e8f3f162d Amir Goldstein 2022-03-20 1212 fsn_mark = NULL;
40822e8f3f162d Amir Goldstein 2022-03-20 1213 goto out_unlock;
88826276dcaf4c Eric Paris 2009-12-17 1214 }
7b18527c4a9539 Lino Sanfilippo 2013-07-08 1215 }
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1216
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1217 /*
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1218 * Error events are pre-allocated per group, only if strictly
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1219 * needed (i.e. FAN_FS_ERROR was requested).
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1220 */
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1221 if (!(flags & FAN_MARK_IGNORED_MASK) && (mask & FAN_FS_ERROR)) {
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1222 ret = fanotify_group_init_error_pool(group);
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1223 if (ret)
40822e8f3f162d Amir Goldstein 2022-03-20 1224 goto out_unlock;
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1225 }
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1226
068909e55d92d2 Amir Goldstein 2022-03-20 1227 ret = fanotify_mark_add_to_mask(fsn_mark, mask, flags);
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1228
40822e8f3f162d Amir Goldstein 2022-03-20 1229 out_unlock:
c97476400d3b73 Jan Kara 2016-12-14 1230 mutex_unlock(&group->mark_mutex);
5e9c070ca08543 Lino Sanfilippo 2013-07-08 1231
40822e8f3f162d Amir Goldstein 2022-03-20 1232 out:
40822e8f3f162d Amir Goldstein 2022-03-20 1233 if (fsn_mark)
fa218ab98c31ee Lino Sanfilippo 2010-11-09 1234 fsnotify_put_mark(fsn_mark);
40822e8f3f162d Amir Goldstein 2022-03-20 1235 if (prealloc_mark)
40822e8f3f162d Amir Goldstein 2022-03-20 1236 kmem_cache_free(fanotify_mark_cache, prealloc_mark);
40822e8f3f162d Amir Goldstein 2022-03-20 1237 if (prealloc_conn)
40822e8f3f162d Amir Goldstein 2022-03-20 1238 fsnotify_conn_free(prealloc_conn);
40822e8f3f162d Amir Goldstein 2022-03-20 1239
734a1a5eccc5f7 Gabriel Krisman Bertazi 2021-10-25 1240 return ret;
88826276dcaf4c Eric Paris 2009-12-17 1241 }
88826276dcaf4c Eric Paris 2009-12-17 1242
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists