All of lore.kernel.org
 help / color / mirror / Atom feed
* [dhowells-fs:netfs-next 24/24] fs/netfs/write_collect.c:155:7: warning: variable 'fpos' is used uninitialized whenever 'if' condition is true
@ 2026-07-17 22:03 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-17 22:03 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:   4b31f42776fcd3c9eaf2c27084026e98aeed5ddc
commit: 4b31f42776fcd3c9eaf2c27084026e98aeed5ddc [24/24] netfs: Combine prepare and issue ops and grab the buffers on request
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260717/202607172354.5AwTxoqH-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/20260717/202607172354.5AwTxoqH-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/202607172354.5AwTxoqH-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/netfs/write_collect.c:155:7: warning: variable 'fpos' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     155 |                 if (!bvecq->bv[slot].bv_page) {
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/write_collect.c:187:7: note: uninitialized use occurs here
     187 |                 if (fpos + fsize >= collected_to)
         |                     ^~~~
   fs/netfs/write_collect.c:155:3: note: remove the 'if' if its condition is always false
     155 |                 if (!bvecq->bv[slot].bv_page) {
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     156 |                         WARN_ONCE(1, "R=%08x slot already cleared?\n", wreq->debug_id);
         |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     157 |                         fsize = bvecq->bv[slot].bv_len;
         |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     158 |                         goto skip;
         |                         ~~~~~~~~~~
     159 |                 }
         |                 ~
   fs/netfs/write_collect.c:137:26: note: initialize the variable 'fpos' to silence this warning
     137 |                 unsigned long long fpos, fend;
         |                                        ^
         |                                         = 0
   1 warning generated.


vim +155 fs/netfs/write_collect.c

   111	
   112	/*
   113	 * Unlock any folios we've finished with.
   114	 */
   115	static void netfs_writeback_unlock_folios(struct netfs_io_request *wreq,
   116						  unsigned int *notes)
   117	{
   118		struct bvecq *bvecq = wreq->collect_cursor.bvecq;
   119		unsigned long long collected_to = wreq->collected_to;
   120		unsigned int slot = wreq->collect_cursor.slot;
   121	
   122		if (WARN_ON_ONCE(!bvecq)) {
   123			pr_err("[!] Writeback unlock found empty buffer!\n");
   124			netfs_dump_request(wreq);
   125			return;
   126		}
   127	
   128		if (wreq->origin == NETFS_PGPRIV2_COPY_TO_CACHE) {
   129			if (netfs_pgpriv2_unlock_copied_folios(wreq))
   130				*notes |= MADE_PROGRESS;
   131			return;
   132		}
   133	
   134		for (;;) {
   135			struct folio *folio;
   136			struct netfs_folio *finfo;
   137			unsigned long long fpos, fend;
   138			size_t fsize, flen;
   139	
   140			/* Try to clean up the head of the queue if it appears to be
   141			 * used up, but we need to be very careful - the cleanup can
   142			 * catch the dispatcher, which could lead to us having nothing
   143			 * left in the queue, causing the front and back pointers to
   144			 * end up on different tracks.  To avoid this, we must always
   145			 * keep at least one segment in the queue.
   146			 */
   147			if (!bvecq_acquire_slot(bvecq, slot)) {
   148				wreq->collect_cursor.slot = slot;
   149				if (!bvecq_delete_spent(&wreq->collect_cursor))
   150					return;
   151				bvecq = wreq->collect_cursor.bvecq;
   152				slot  = wreq->collect_cursor.slot;
   153			}
   154	
 > 155			if (!bvecq->bv[slot].bv_page) {
   156				WARN_ONCE(1, "R=%08x slot already cleared?\n", wreq->debug_id);
   157				fsize = bvecq->bv[slot].bv_len;
   158				goto skip;
   159			}
   160	
   161			folio = page_folio(bvecq->bv[slot].bv_page);
   162			if (WARN_ONCE(!folio_test_writeback(folio),
   163				      "R=%08x: folio %lx is not under writeback\n",
   164				      wreq->debug_id, folio->index))
   165				trace_netfs_folio(folio, netfs_folio_trace_not_under_wback);
   166	
   167			fpos = folio_pos(folio);
   168			fsize = folio_size(folio);
   169			finfo = netfs_folio_info(folio);
   170			flen = finfo ? finfo->dirty_offset + finfo->dirty_len : fsize;
   171	
   172			fend = min_t(unsigned long long, fpos + flen, wreq->i_size);
   173	
   174			trace_netfs_collect_folio(wreq, folio, fend, collected_to);
   175	
   176			/* Unlock any folio we've transferred all of. */
   177			if (collected_to < fend)
   178				break;
   179	
   180			wreq->nr_group_rel += netfs_folio_written_back(folio);
   181			wreq->cleaned_to = fpos + fsize;
   182			*notes |= MADE_PROGRESS;
   183	
   184			bvecq->bv[slot].bv_page = NULL;
   185		skip:
   186			slot++;
   187			if (fpos + fsize >= collected_to)
   188				break;
   189		}
   190	
   191		wreq->collect_cursor.slot = slot;
   192	}
   193	

--
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-17 22:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 22:03 [dhowells-fs:netfs-next 24/24] fs/netfs/write_collect.c:155:7: warning: variable 'fpos' is used uninitialized whenever 'if' condition is true kernel test robot

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.