Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [dhowells-fs:netfs-next 21/21] fs/9p/vfs_addr.c:106:22: warning: unused variable 'n'
@ 2026-07-03  1:35 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-03  1:35 UTC (permalink / raw)
  To: David Howells; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-next
head:   e291bb0346f243b63b5fca4ef35e440585cda032
commit: e291bb0346f243b63b5fca4ef35e440585cda032 [21/21] netfs: Combine prepare and issue ops and grab the buffers on request
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260703/202607030306.D7Uwq0jT-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260703/202607030306.D7Uwq0jT-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/202607030306.D7Uwq0jT-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/9p/vfs_addr.c:79:6: warning: variable 'len' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      79 |         if (err < 0)
         |             ^~~~~~~
   fs/9p/vfs_addr.c:90:51: note: uninitialized use occurs here
      90 |         return netfs_write_subrequest_terminated(subreq, len ?: err);
         |                                                          ^~~
   fs/9p/vfs_addr.c:79:2: note: remove the 'if' if its condition is always false
      79 |         if (err < 0)
         |         ^~~~~~~~~~~~
      80 |                 goto term;
         |                 ~~~~~~~~~
   fs/9p/vfs_addr.c:74:14: note: initialize the variable 'len' to silence this warning
      74 |         int err, len;
         |                     ^
         |                      = 0
>> fs/9p/vfs_addr.c:106:22: warning: unused variable 'n' [-Wunused-variable]
     106 |         int total = 0, err, n;
         |                             ^
   2 warnings generated.


vim +/n +106 fs/9p/vfs_addr.c

    92	
    93	/**
    94	 * v9fs_issue_read - Issue a read from 9P
    95	 * @subreq: The read to make
    96	 * @rctx: Read generation context
    97	 */
    98	static void v9fs_issue_read(struct netfs_io_subrequest *subreq)
    99	{
   100		struct netfs_io_request *rreq = subreq->rreq;
   101		struct iov_iter iter;
   102		struct p9_fid *fid = rreq->netfs_priv;
   103		char *target;
   104		unsigned long long pos = subreq->start + subreq->transferred;
   105		size_t len;
 > 106		int total = 0, err, n;
   107	
   108		err = netfs_prepare_read_buffer(subreq, INT_MAX);
   109		if (err < 0)
   110			goto term;
   111	
   112		iov_iter_bvec_queue(&iter, ITER_DEST, subreq->content.bvecq,
   113				    subreq->content.slot, subreq->content.offset, subreq->len);
   114	
   115		if (S_ISLNK(rreq->inode->i_mode)) {
   116			/* p9_client_readlink() must not be called for legacy protocols
   117			 * 9p2000 or 9p2000.u.
   118			 */
   119			BUG_ON(!p9_is_proto_dotl(fid->clnt));
   120			if (WARN_ON_ONCE(pos)) {
   121				/* reading a link at a non null offset should
   122				 * not happen
   123				 */
   124				err = -EIO;
   125				goto fill_subreq;
   126			}
   127			err = p9_client_readlink(fid, &target);
   128			if (err != 0)
   129				goto fill_subreq;
   130			len = min(strlen(target), subreq->len);
   131			total = copy_to_iter(target, len, &iter);
   132			kfree(target);
   133		} else {
   134			trace_netfs_sreq(subreq, netfs_sreq_trace_submit);
   135	
   136			total = p9_client_read(fid, pos, &iter, &err);
   137		}
   138	
   139	fill_subreq:
   140		/* if we just extended the file size, any portion not in
   141		 * cache won't be on server and is zeroes */
   142		if (subreq->rreq->origin != NETFS_UNBUFFERED_READ &&
   143		    subreq->rreq->origin != NETFS_DIO_READ)
   144			__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
   145		if (pos + total >= i_size_read(rreq->inode))
   146			__set_bit(NETFS_SREQ_HIT_EOF, &subreq->flags);
   147		if (!err && total) {
   148			subreq->transferred += total;
   149			__set_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
   150		}
   151	
   152	term:
   153		subreq->error = err;
   154		return netfs_read_subreq_terminated(subreq);
   155	}
   156	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-03  1:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-03  1:35 [dhowells-fs:netfs-next 21/21] fs/9p/vfs_addr.c:106:22: warning: unused variable 'n' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox