Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Howells <dhowells@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [dhowells-fs:netfs-next 11/22] fs/afs/symlink.c:97:7: warning: variable 'ret' is uninitialized when used here
Date: Wed, 10 Jun 2026 03:59:51 +0800	[thread overview]
Message-ID: <202606100329.iHRpefyn-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-next
head:   1d9a108be2c6acdd19dfad7fd3f536c79810dafa
commit: 169b840c161aff8f6ece83314583a409431e2824 [11/22] afs: Use a bvecq to hold dir content rather than folioq
config: riscv-allyesconfig (https://download.01.org/0day-ci/archive/20260610/202606100329.iHRpefyn-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 7917772d7d61384696c61102c08c2ea158e610fa)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260610/202606100329.iHRpefyn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606100329.iHRpefyn-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/afs/symlink.c:97:7: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
      97 |                 if (ret < 0)
         |                     ^~~
   fs/afs/symlink.c:86:13: note: initialize the variable 'ret' to silence this warning
      86 |         ssize_t ret;
         |                    ^
         |                     = 0
   1 warning generated.


vim +/ret +97 fs/afs/symlink.c

c0410adf3da6db David Howells 2026-05-12   78  
c0410adf3da6db David Howells 2026-05-12   79  /*
c0410adf3da6db David Howells 2026-05-12   80   * Read a symlink in a single download.
c0410adf3da6db David Howells 2026-05-12   81   */
c0410adf3da6db David Howells 2026-05-12   82  static ssize_t afs_do_read_symlink(struct afs_vnode *vnode)
c0410adf3da6db David Howells 2026-05-12   83  {
c0410adf3da6db David Howells 2026-05-12   84  	struct afs_symlink *symlink;
c0410adf3da6db David Howells 2026-05-12   85  	struct iov_iter iter;
c0410adf3da6db David Howells 2026-05-12   86  	ssize_t ret;
c0410adf3da6db David Howells 2026-05-12   87  	loff_t i_size;
c0410adf3da6db David Howells 2026-05-12   88  
c0410adf3da6db David Howells 2026-05-12   89  	i_size = i_size_read(&vnode->netfs.inode);
c0410adf3da6db David Howells 2026-05-12   90  	if (i_size > PAGE_SIZE - 1) {
c0410adf3da6db David Howells 2026-05-12   91  		trace_afs_file_error(vnode, -EFBIG, afs_file_error_dir_big);
c0410adf3da6db David Howells 2026-05-12   92  		return -EFBIG;
c0410adf3da6db David Howells 2026-05-12   93  	}
c0410adf3da6db David Howells 2026-05-12   94  
c0410adf3da6db David Howells 2026-05-12   95  	if (!vnode->directory) {
169b840c161aff David Howells 2026-01-07   96  		vnode->directory = bvecq_alloc_buffer(PAGE_SIZE, GFP_KERNEL);
c0410adf3da6db David Howells 2026-05-12  @97  		if (ret < 0)
c0410adf3da6db David Howells 2026-05-12   98  			return ret;
c0410adf3da6db David Howells 2026-05-12   99  	}
c0410adf3da6db David Howells 2026-05-12  100  
169b840c161aff David Howells 2026-01-07  101  	iov_iter_bvec_queue(&iter, ITER_DEST, vnode->directory, 0, 0, PAGE_SIZE);
c0410adf3da6db David Howells 2026-05-12  102  
c0410adf3da6db David Howells 2026-05-12  103  	/* AFS requires us to perform the read of a symlink as a single unit to
c0410adf3da6db David Howells 2026-05-12  104  	 * avoid issues with the content being changed between reads.
c0410adf3da6db David Howells 2026-05-12  105  	 */
c0410adf3da6db David Howells 2026-05-12  106  	ret = netfs_read_single(&vnode->netfs.inode, NULL, &iter);
c0410adf3da6db David Howells 2026-05-12  107  	if (ret >= 0) {
c0410adf3da6db David Howells 2026-05-12  108  		i_size = ret;
c0410adf3da6db David Howells 2026-05-12  109  		if (i_size > PAGE_SIZE - 1) {
c0410adf3da6db David Howells 2026-05-12  110  			trace_afs_file_error(vnode, -EFBIG, afs_file_error_dir_big);
c0410adf3da6db David Howells 2026-05-12  111  			return -EFBIG;
c0410adf3da6db David Howells 2026-05-12  112  		}
c0410adf3da6db David Howells 2026-05-12  113  		vnode->directory_size = i_size;
c0410adf3da6db David Howells 2026-05-12  114  
c0410adf3da6db David Howells 2026-05-12  115  		/* Copy the symlink. */
c0410adf3da6db David Howells 2026-05-12  116  		symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1,
c0410adf3da6db David Howells 2026-05-12  117  				       GFP_KERNEL);
c0410adf3da6db David Howells 2026-05-12  118  		if (!symlink)
c0410adf3da6db David Howells 2026-05-12  119  			return -ENOMEM;
c0410adf3da6db David Howells 2026-05-12  120  
c0410adf3da6db David Howells 2026-05-12  121  		refcount_set(&symlink->ref, 1);
c0410adf3da6db David Howells 2026-05-12  122  		symlink->content[i_size] = 0;
c0410adf3da6db David Howells 2026-05-12  123  
169b840c161aff David Howells 2026-01-07  124  		const char *s = bvec_kmap_partial(&vnode->directory->bv[0], 0);
c0410adf3da6db David Howells 2026-05-12  125  
c0410adf3da6db David Howells 2026-05-12  126  		memcpy(symlink->content, s, i_size);
c0410adf3da6db David Howells 2026-05-12  127  		kunmap_local(s);
c0410adf3da6db David Howells 2026-05-12  128  
c0410adf3da6db David Howells 2026-05-12  129  		afs_replace_symlink(vnode, symlink);
c0410adf3da6db David Howells 2026-05-12  130  	}
c0410adf3da6db David Howells 2026-05-12  131  
c0410adf3da6db David Howells 2026-05-12  132  	if (!fscache_cookie_enabled(netfs_i_cookie(&vnode->netfs))) {
169b840c161aff David Howells 2026-01-07  133  		bvecq_put(vnode->directory);
c0410adf3da6db David Howells 2026-05-12  134  		vnode->directory = NULL;
c0410adf3da6db David Howells 2026-05-12  135  		vnode->directory_size = 0;
c0410adf3da6db David Howells 2026-05-12  136  	}
c0410adf3da6db David Howells 2026-05-12  137  
c0410adf3da6db David Howells 2026-05-12  138  	return ret;
c0410adf3da6db David Howells 2026-05-12  139  }
c0410adf3da6db David Howells 2026-05-12  140  

:::::: The code at line 97 was first introduced by commit
:::::: c0410adf3da6db46f3513411fcf95e63c2f1d1ad afs: Fix the locking used by afs_get_link()

:::::: TO: David Howells <dhowells@redhat.com>
:::::: CC: Christian Brauner <brauner@kernel.org>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-06-09 20:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202606100329.iHRpefyn-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dhowells@redhat.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox