public inbox for llvm@lists.linux.dev
 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-crypt 36/37] fs/netfs/direct_read.c:291:25: warning: variable 'start' is uninitialized when used here
Date: Wed, 4 Sep 2024 00:07:20 +0800	[thread overview]
Message-ID: <202409040018.dK9qOlqV-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-crypt
head:   3962f4beba4e7ffa6cfab018df8a612902a1d2c8
commit: 504a8d4b08293dbaa09e7057f3b4ea045ba52d29 [36/37] netfs: Implement bounce-buffering for unbuffered/DIO read
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240904/202409040018.dK9qOlqV-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240904/202409040018.dK9qOlqV-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/202409040018.dK9qOlqV-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/netfs/direct_read.c:291:25: warning: variable 'start' is uninitialized when used here [-Wuninitialized]
     291 |                 _debug("bounce %llx", start);
         |                                       ^~~~~
   fs/netfs/internal.h:445:17: note: expanded from macro '_debug'
     445 |                 kdebug(FMT, ##__VA_ARGS__);     \
         |                               ^~~~~~~~~~~
   fs/netfs/internal.h:422:43: note: expanded from macro 'kdebug'
     422 | #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__)
         |                                           ^~~~~~~~~~~
   fs/netfs/internal.h:418:46: note: expanded from macro 'dbgprintk'
     418 |         printk("[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
         |                                                     ^~~~~~~~~~~
   include/linux/printk.h:465:60: note: expanded from macro 'printk'
     465 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                            ^~~~~~~~~~~
   include/linux/printk.h:437:19: note: expanded from macro 'printk_index_wrap'
     437 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   fs/netfs/direct_read.c:235:26: note: initialize the variable 'start' to silence this warning
     235 |         unsigned long long start;
         |                                 ^
         |                                  = 0
   1 warning generated.


vim +/start +291 fs/netfs/direct_read.c

   220	
   221	/**
   222	 * netfs_unbuffered_read_iter_locked - Perform an unbuffered or direct I/O read
   223	 * @iocb: The I/O control descriptor describing the read
   224	 * @iter: The output buffer (also specifies read length)
   225	 *
   226	 * Perform an unbuffered I/O or direct I/O from the file in @iocb to the
   227	 * output buffer.  No use is made of the pagecache.
   228	 *
   229	 * The caller must hold any appropriate locks.
   230	 */
   231	ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter)
   232	{
   233		struct netfs_io_request *rreq;
   234		struct netfs_inode *ictx;
   235		unsigned long long start;
   236		ssize_t ret;
   237		size_t orig_count = iov_iter_count(iter);
   238		bool sync = is_sync_kiocb(iocb);
   239	
   240		_enter("");
   241	
   242		if (!orig_count)
   243			return 0; /* Don't update atime */
   244	
   245		ret = kiocb_write_and_wait(iocb, orig_count);
   246		if (ret < 0)
   247			return ret;
   248		file_accessed(iocb->ki_filp);
   249	
   250		rreq = netfs_alloc_request(iocb->ki_filp->f_mapping, iocb->ki_filp,
   251					   iocb->ki_pos, orig_count,
   252					   NETFS_DIO_READ);
   253		if (IS_ERR(rreq))
   254			return PTR_ERR(rreq);
   255	
   256		ictx = netfs_inode(rreq->inode);
   257		netfs_stat(&netfs_n_rh_dio_read);
   258		trace_netfs_read(rreq, rreq->start, rreq->len, netfs_read_trace_dio_read);
   259	
   260		/* If this is an async op, we have to keep track of the destination
   261		 * buffer for ourselves as the caller's iterator will be trashed when
   262		 * we return.
   263		 *
   264		 * In such a case, extract an iterator to represent as much of the the
   265		 * output buffer as we can manage.  Note that the extraction might not
   266		 * be able to allocate a sufficiently large bvec array and may shorten
   267		 * the request.
   268		 */
   269		if (user_backed_iter(iter)) {
   270			ret = netfs_extract_user_iter(iter, rreq->len, &rreq->buffer.iter, 0);
   271			if (ret < 0)
   272				goto out;
   273			rreq->direct_bv = (struct bio_vec *)rreq->buffer.iter.bvec;
   274			rreq->direct_bv_count = ret;
   275			rreq->direct_bv_unpin = iov_iter_extract_will_pin(iter);
   276			rreq->len = iov_iter_count(&rreq->buffer.iter);
   277		} else {
   278			rreq->buffer.iter = *iter;
   279			rreq->len = orig_count;
   280			rreq->direct_bv_unpin = false;
   281			iov_iter_advance(iter, orig_count);
   282		}
   283	
   284		/* If we're going to use a bounce buffer, we need to set it up.  We
   285		 * will then need to pad the request out to the minimum block size.
   286		 */
   287		if (test_bit(NETFS_RREQ_USE_BOUNCE_BUFFER, &rreq->flags)) {
   288			size_t min_bsize = 1UL << ictx->crypto_bshift;
   289	
   290			rreq->bounce_alloc_to = round_down(rreq->start, min_bsize);
 > 291			_debug("bounce %llx", start);
   292	
   293			ret = netfs_alloc_bounce(rreq, rreq->bounce_alloc_to + min_bsize, GFP_KERNEL);
   294			if (ret < 0)
   295				goto out;
   296		}
   297	
   298		if (!sync)
   299			rreq->iocb = iocb;
   300	
   301		ret = netfs_unbuffered_read(rreq, sync);
   302		if (ret < 0)
   303			goto out; /* May be -EIOCBQUEUED */
   304		if (sync) {
   305			ret = netfs_dio_copy_bounce_to_dest(rreq, iocb);
   306			if (ret == 0) {
   307				iocb->ki_pos += rreq->transferred;
   308				ret = rreq->transferred;
   309			}
   310		}
   311	
   312	out:
   313		netfs_put_request(rreq, false, netfs_rreq_trace_put_return);
   314		if (ret > 0)
   315			orig_count -= ret;
   316		return ret;
   317	}
   318	EXPORT_SYMBOL(netfs_unbuffered_read_iter_locked);
   319	

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

                 reply	other threads:[~2024-09-03 16:08 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=202409040018.dK9qOlqV-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