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 24/24] fs/netfs/write_collect.c:155:7: warning: variable 'fpos' is used uninitialized whenever 'if' condition is true
Date: Sat, 18 Jul 2026 00:03:00 +0200 [thread overview]
Message-ID: <202607172354.5AwTxoqH-lkp@intel.com> (raw)
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
reply other threads:[~2026-07-17 22:04 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=202607172354.5AwTxoqH-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 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.