tree: git://git.samba.org/sfrench/cifs-2.6.git for-next head: ef605e86821253d16d47a02ce1f766a461614fef commit: ef605e86821253d16d47a02ce1f766a461614fef [8/8] cifs: skip trailing separators of prefix paths config: arm-randconfig-c002-20220603 (https://download.01.org/0day-ci/archive/20220604/202206041223.Kx81JSQt-lkp@xxxxxxxxx/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b364c76683f8ef241025a9556300778c07b590c2) 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 arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi git remote add cifs git://git.samba.org/sfrench/cifs-2.6.git git fetch --no-tags cifs for-next git checkout ef605e86821253d16d47a02ce1f766a461614fef # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash fs/cifs/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>): >> fs/cifs/dfs_cache.c:1294:2: warning: variable 'ppath' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (target_pplen || dfsref_pplen) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/cifs/dfs_cache.c:1307:12: note: uninitialized use occurs here *prefix = ppath; ^~~~~ fs/cifs/dfs_cache.c:1294:2: note: remove the 'if' if its condition is always true if (target_pplen || dfsref_pplen) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ fs/cifs/dfs_cache.c:1270:28: note: initialize the variable 'ppath' to silence this warning char *target_share, *ppath; ^ = NULL 1 warning generated. vim +1294 fs/cifs/dfs_cache.c 1255 1256 /** 1257 * dfs_cache_get_tgt_share - parse a DFS target 1258 * 1259 * @path: DFS full path 1260 * @it: DFS target iterator. 1261 * @share: tree name. 1262 * @prefix: prefix path. 1263 * 1264 * Return zero if target was parsed correctly, otherwise non-zero. 1265 */ 1266 int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it, char **share, 1267 char **prefix) 1268 { 1269 char sep; 1270 char *target_share, *ppath; 1271 const char *target_ppath, *dfsref_ppath; 1272 size_t target_pplen, dfsref_pplen; 1273 size_t len, c; 1274 1275 if (!it || !path || !share || !prefix || strlen(path) < it->it_path_consumed) 1276 return -EINVAL; 1277 1278 sep = it->it_name[0]; 1279 if (sep != '\\' && sep != '/') 1280 return -EINVAL; 1281 1282 target_ppath = parse_target_share(it->it_name, &target_share); 1283 if (IS_ERR(target_ppath)) 1284 return PTR_ERR(target_ppath); 1285 1286 /* point to prefix in DFS referral path */ 1287 dfsref_ppath = path + it->it_path_consumed; 1288 dfsref_ppath += strspn(dfsref_ppath, "/\\"); 1289 1290 target_pplen = strlen(target_ppath); 1291 dfsref_pplen = strlen(dfsref_ppath); 1292 1293 /* merge prefix paths from DFS referral path and target node */ > 1294 if (target_pplen || dfsref_pplen) { 1295 len = target_pplen + dfsref_pplen + 2; 1296 ppath = kzalloc(len, GFP_KERNEL); 1297 if (!ppath) { 1298 kfree(target_share); 1299 return -ENOMEM; 1300 } 1301 c = strscpy(ppath, target_ppath, len); 1302 if (c && dfsref_pplen) 1303 ppath[c] = sep; 1304 strlcat(ppath, dfsref_ppath, len); 1305 } 1306 *share = target_share; 1307 *prefix = ppath; 1308 return 0; 1309 } 1310 -- 0-DAY CI Kernel Test Service https://01.org/lkp