All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Howells <dhowells@redhat.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.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
Date: Wed, 13 Oct 2021 01:56:46 +0800	[thread overview]
Message-ID: <202110130142.qObGbYVk-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3757 bytes --]

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@intel.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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27479 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.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
Date: Wed, 13 Oct 2021 01:56:46 +0800	[thread overview]
Message-ID: <202110130142.qObGbYVk-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3849 bytes --]

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@intel.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(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27479 bytes --]

             reply	other threads:[~2021-10-12 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 17:56 kernel test robot [this message]
2021-10-12 17:56 ` [dhowells-fs:fscache-rewrite-indexing 78/80] fs/cachefiles/namei.c:403:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202110130142.qObGbYVk-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dhowells@redhat.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.