[dhowells-fs:fscache-rewrite-indexing 74/74] fs/cachefiles/namei.c:347:63: warning: variable 'ret' is uninitialized when used here

From: kernel test robot
Date: Wed Oct 13 2021 - 18:09:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git fscache-rewrite-indexing
head: c4c64220b16dd9204a79685fe34d61c1b7f858a6
commit: c4c64220b16dd9204a79685fe34d61c1b7f858a6 [74/74] cachefiles: Add tracepoints to log errors from ops on the backing fs
config: i386-randconfig-r034-20211013 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a8c695542b2987eb9a203d5663a0740cb4725f)
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://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=c4c64220b16dd9204a79685fe34d61c1b7f858a6
git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
git fetch --no-tags dhowells-fs fscache-rewrite-indexing
git checkout c4c64220b16dd9204a79685fe34d61c1b7f858a6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

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

All warnings (new ones prefixed by >>):

>> fs/cachefiles/namei.c:347:63: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
trace_cachefiles_vfs_error(object, d_backing_inode(dentry), ret,
^~~
fs/cachefiles/namei.c:331:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.


vim +/ret +347 fs/cachefiles/namei.c

320
321 /*
322 * Open an existing file, checking its attributes and replacing it if it is
323 * stale.
324 */
325 static bool cachefiles_open_file(struct cachefiles_object *object,
326 struct dentry *dentry)
327 {
328 struct cachefiles_cache *cache = object->volume->cache;
329 struct file *file;
330 struct path path;
331 int ret;
332
333 _enter("%pd", dentry);
334
335 if (!cachefiles_mark_inode_in_use(object, dentry))
336 return false;
337
338 /* We need to open a file interface onto a data file now as we can't do
339 * it on demand because writeback called from do_exit() sees
340 * current->fs == NULL - which breaks d_path() called from ext4 open.
341 */
342 path.mnt = cache->mnt;
343 path.dentry = dentry;
344 file = open_with_fake_path(&path, O_RDWR | O_LARGEFILE | O_DIRECT,
345 d_backing_inode(dentry), cache->cache_cred);
346 if (IS_ERR(file)) {
> 347 trace_cachefiles_vfs_error(object, d_backing_inode(dentry), ret,
348 cachefiles_trace_open_error);
349 goto error;
350 }
351
352 if (unlikely(!file->f_op->read_iter) ||
353 unlikely(!file->f_op->write_iter)) {
354 pr_notice("Cache does not support read_iter and write_iter\n");
355 goto error_fput;
356 }
357 _debug("file -> %pd positive", dentry);
358
359 ret = cachefiles_check_auxdata(object, file);
360 if (ret < 0)
361 goto check_failed;
362
363 object->file = file;
364
365 /* Always update the atime on an object we've just looked up (this is
366 * used to keep track of culling, and atimes are only updated by read,
367 * write and readdir but not lookup or open).
368 */
369 touch_atime(&file->f_path);
370 dput(dentry);
371 return true;
372
373 check_failed:
374 fscache_cookie_lookup_negative(object->cookie);
375 cachefiles_unmark_inode_in_use(object, file);
376 cachefiles_mark_object_inactive(object, file);
377 if (ret == -ESTALE) {
378 fput(file);
379 dput(dentry);
380 return cachefiles_create_file(object);
381 }
382 error_fput:
383 fput(file);
384 error:
385 dput(dentry);
386 return false;
387 }
388

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

Attachment: .config.gz
Description: application/gzip