[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202110130142.qObGbYVk-lkp@intel.com>
Date: Wed, 13 Oct 2021 01:56:46 +0800
From: kernel test robot <lkp@...el.com>
To: David Howells <dhowells@...hat.com>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [dhowells-fs:fscache-rewrite-indexing 78/80]
fs/cachefiles/namei.c:403:6: error: variable 'ret' is used uninitialized
whenever 'if' condition is true
tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git fscache-rewrite-indexing
head: 5914ee72cd59ac43f27adae6340e8219592462d5
commit: b91996136a2f21b2815b8946274abe7064a7dceb [78/80] cachefiles: Don't set object->file until after open is successful
config: hexagon-buildonly-randconfig-r005-20211012 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
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=b91996136a2f21b2815b8946274abe7064a7dceb
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 b91996136a2f21b2815b8946274abe7064a7dceb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
>> fs/cachefiles/namei.c:403:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (!cachefiles_open_file(object, dentry))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/cachefiles/namei.c:412:6: note: uninitialized use occurs here
if (ret == -EIO)
^~~
fs/cachefiles/namei.c:403:2: note: remove the 'if' if its condition is always false
if (!cachefiles_open_file(object, dentry))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/cachefiles/namei.c:378:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 error generated.
vim +403 fs/cachefiles/namei.c
369
370 /*
371 * walk from the parent object to the child object through the backing
372 * filesystem, creating directories as we go
373 */
374 bool cachefiles_look_up_object(struct cachefiles_object *object)
375 {
376 struct cachefiles_volume *volume = object->volume;
377 struct dentry *dentry, *fan = volume->fanout[(u8)object->key_hash];
378 int ret;
379
380 _enter("OBJ%x,%s,", object->debug_id, object->d_name);
381
382 /* Look up path "cache/vol/fanout/file". */
383 dentry = lookup_positive_unlocked(object->d_name, fan, object->d_name_len);
384 trace_cachefiles_lookup(object, dentry);
385 if (IS_ERR(dentry)) {
386 if (dentry == ERR_PTR(-ENOENT))
387 goto new_file;
388 ret = PTR_ERR(dentry);
389 goto lookup_error;
390 }
391
392 if (!d_is_reg(dentry)) {
393 pr_err("%pd is not a file\n", dentry);
394 inode_lock_nested(d_inode(fan), I_MUTEX_PARENT);
395 ret = cachefiles_bury_object(volume->cache, object, fan, dentry,
396 FSCACHE_OBJECT_IS_WEIRD);
397 dput(dentry);
398 if (ret < 0)
399 return false;
400 goto new_file;
401 }
402
> 403 if (!cachefiles_open_file(object, dentry))
404 goto lookup_error;
405
406 _leave(" = t [%lu]", file_inode(object->file)->i_ino);
407 return true;
408
409 new_file:
410 return cachefiles_create_file(object);
411 lookup_error:
412 if (ret == -EIO)
413 cachefiles_io_error_obj(object, "Lookup failed");
414 return false;
415 }
416
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (27479 bytes)
Powered by blists - more mailing lists