* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
[not found] <20250811-iot_iter_folio-v1-1-d9c223adf93c@codewreck.org>
@ 2025-08-11 18:55 ` kernel test robot
2025-08-13 5:16 ` Nathan Chancellor
0 siblings, 1 reply; 9+ messages in thread
From: kernel test robot @ 2025-08-11 18:55 UTC (permalink / raw)
To: Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Christian Brauner, David Howells, Alexander Viro, Andrew Morton
Cc: llvm, oe-kbuild-all, Linux Memory Management List,
Maximilian Bosch, Ryan Lahfa, Christian Theune, Arnout Engelen,
linux-kernel, linux-block, linux-fsdevel, Dominique Martinet,
stable
Hi Dominique,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 8f5ae30d69d7543eee0d70083daf4de8fe15d585]
url: https://github.com/intel-lab-lkp/linux/commits/Dominique-Martinet-via-B4-Relay/iov_iter-iterate_folioq-fix-handling-of-offset-folio-size/20250811-154319
base: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
patch link: https://lore.kernel.org/r/20250811-iot_iter_folio-v1-1-d9c223adf93c%40codewreck.org
patch subject: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
config: i386-buildonly-randconfig-002-20250811 (https://download.01.org/0day-ci/archive/20250812/202508120250.Eooq2ydr-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250812/202508120250.Eooq2ydr-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/202508120250.Eooq2ydr-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from lib/iov_iter.c:14:
>> include/linux/iov_iter.h:171:7: warning: variable 'remain' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
171 | if (skip >= fsize)
| ^~~~~~~~~~~~~
include/linux/iov_iter.h:190:7: note: uninitialized use occurs here
190 | if (remain)
| ^~~~~~
include/linux/iov_iter.h:171:3: note: remove the 'if' if its condition is always false
171 | if (skip >= fsize)
| ^~~~~~~~~~~~~~~~~~
172 | goto next;
| ~~~~~~~~~
include/linux/iov_iter.h:163:22: note: initialize the variable 'remain' to silence this warning
163 | size_t part, remain, consumed;
| ^
| = 0
1 warning generated.
vim +171 include/linux/iov_iter.h
143
144 /*
145 * Handle ITER_FOLIOQ.
146 */
147 static __always_inline
148 size_t iterate_folioq(struct iov_iter *iter, size_t len, void *priv, void *priv2,
149 iov_step_f step)
150 {
151 const struct folio_queue *folioq = iter->folioq;
152 unsigned int slot = iter->folioq_slot;
153 size_t progress = 0, skip = iter->iov_offset;
154
155 if (slot == folioq_nr_slots(folioq)) {
156 /* The iterator may have been extended. */
157 folioq = folioq->next;
158 slot = 0;
159 }
160
161 do {
162 struct folio *folio = folioq_folio(folioq, slot);
163 size_t part, remain, consumed;
164 size_t fsize;
165 void *base;
166
167 if (!folio)
168 break;
169
170 fsize = folioq_folio_size(folioq, slot);
> 171 if (skip >= fsize)
172 goto next;
173 base = kmap_local_folio(folio, skip);
174 part = umin(len, PAGE_SIZE - skip % PAGE_SIZE);
175 remain = step(base, progress, part, priv, priv2);
176 kunmap_local(base);
177 consumed = part - remain;
178 len -= consumed;
179 progress += consumed;
180 skip += consumed;
181 if (skip >= fsize) {
182 next:
183 skip = 0;
184 slot++;
185 if (slot == folioq_nr_slots(folioq) && folioq->next) {
186 folioq = folioq->next;
187 slot = 0;
188 }
189 }
190 if (remain)
191 break;
192 } while (len);
193
194 iter->folioq_slot = slot;
195 iter->folioq = folioq;
196 iter->iov_offset = skip;
197 iter->count -= progress;
198 return progress;
199 }
200
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-11 18:55 ` [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size kernel test robot
@ 2025-08-13 5:16 ` Nathan Chancellor
2025-08-13 5:34 ` Dominique Martinet
2025-08-13 13:49 ` David Howells
0 siblings, 2 replies; 9+ messages in thread
From: Nathan Chancellor @ 2025-08-13 5:16 UTC (permalink / raw)
To: kernel test robot
Cc: Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Christian Brauner, David Howells, Alexander Viro, Andrew Morton,
llvm, oe-kbuild-all, Linux Memory Management List,
Maximilian Bosch, Ryan Lahfa, Christian Theune, Arnout Engelen,
linux-kernel, linux-block, linux-fsdevel, Dominique Martinet,
stable
On Tue, Aug 12, 2025 at 02:55:55AM +0800, kernel test robot wrote:
> Hi Dominique,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on 8f5ae30d69d7543eee0d70083daf4de8fe15d585]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Dominique-Martinet-via-B4-Relay/iov_iter-iterate_folioq-fix-handling-of-offset-folio-size/20250811-154319
> base: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
> patch link: https://lore.kernel.org/r/20250811-iot_iter_folio-v1-1-d9c223adf93c%40codewreck.org
> patch subject: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
> config: i386-buildonly-randconfig-002-20250811 (https://download.01.org/0day-ci/archive/20250812/202508120250.Eooq2ydr-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250812/202508120250.Eooq2ydr-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/202508120250.Eooq2ydr-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> In file included from lib/iov_iter.c:14:
> >> include/linux/iov_iter.h:171:7: warning: variable 'remain' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> 171 | if (skip >= fsize)
> | ^~~~~~~~~~~~~
> include/linux/iov_iter.h:190:7: note: uninitialized use occurs here
> 190 | if (remain)
> | ^~~~~~
> include/linux/iov_iter.h:171:3: note: remove the 'if' if its condition is always false
> 171 | if (skip >= fsize)
> | ^~~~~~~~~~~~~~~~~~
> 172 | goto next;
> | ~~~~~~~~~
> include/linux/iov_iter.h:163:22: note: initialize the variable 'remain' to silence this warning
> 163 | size_t part, remain, consumed;
> | ^
> | = 0
> 1 warning generated.
I see this in -next now, should remain be zero initialized or is there
some other fix that is needed?
> vim +171 include/linux/iov_iter.h
>
> 143
> 144 /*
> 145 * Handle ITER_FOLIOQ.
> 146 */
> 147 static __always_inline
> 148 size_t iterate_folioq(struct iov_iter *iter, size_t len, void *priv, void *priv2,
> 149 iov_step_f step)
> 150 {
> 151 const struct folio_queue *folioq = iter->folioq;
> 152 unsigned int slot = iter->folioq_slot;
> 153 size_t progress = 0, skip = iter->iov_offset;
> 154
> 155 if (slot == folioq_nr_slots(folioq)) {
> 156 /* The iterator may have been extended. */
> 157 folioq = folioq->next;
> 158 slot = 0;
> 159 }
> 160
> 161 do {
> 162 struct folio *folio = folioq_folio(folioq, slot);
> 163 size_t part, remain, consumed;
> 164 size_t fsize;
> 165 void *base;
> 166
> 167 if (!folio)
> 168 break;
> 169
> 170 fsize = folioq_folio_size(folioq, slot);
> > 171 if (skip >= fsize)
> 172 goto next;
> 173 base = kmap_local_folio(folio, skip);
> 174 part = umin(len, PAGE_SIZE - skip % PAGE_SIZE);
> 175 remain = step(base, progress, part, priv, priv2);
> 176 kunmap_local(base);
> 177 consumed = part - remain;
> 178 len -= consumed;
> 179 progress += consumed;
> 180 skip += consumed;
> 181 if (skip >= fsize) {
> 182 next:
> 183 skip = 0;
> 184 slot++;
> 185 if (slot == folioq_nr_slots(folioq) && folioq->next) {
> 186 folioq = folioq->next;
> 187 slot = 0;
> 188 }
> 189 }
> 190 if (remain)
> 191 break;
> 192 } while (len);
> 193
> 194 iter->folioq_slot = slot;
> 195 iter->folioq = folioq;
> 196 iter->iov_offset = skip;
> 197 iter->count -= progress;
> 198 return progress;
> 199 }
> 200
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-13 5:16 ` Nathan Chancellor
@ 2025-08-13 5:34 ` Dominique Martinet
2025-08-13 13:39 ` Andy Shevchenko
2025-08-13 13:49 ` David Howells
1 sibling, 1 reply; 9+ messages in thread
From: Dominique Martinet @ 2025-08-13 5:34 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, Dominique Martinet via B4 Relay,
Matthew Wilcox (Oracle), Christian Brauner, David Howells,
Alexander Viro, Andrew Morton, llvm, oe-kbuild-all,
Linux Memory Management List, Maximilian Bosch, Ryan Lahfa,
Christian Theune, Arnout Engelen, linux-kernel, linux-block,
linux-fsdevel, stable
Nathan Chancellor wrote on Tue, Aug 12, 2025 at 10:16:33PM -0700:
> > 1 warning generated.
>
> I see this in -next now, should remain be zero initialized or is there
> some other fix that is needed?
A zero-initialization is fine, I sent a v2 with zero-initialization
fixed yesterday:
https://lkml.kernel.org/r/20250812-iot_iter_folio-v2-1-f99423309478@codewreck.org
(and I'll send a v3 with the goto replaced with a bigger if later today
as per David's request)
I assume Andrew will pick it up eventually?
--
Dominique Martinet | Asmadeus
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-13 5:34 ` Dominique Martinet
@ 2025-08-13 13:39 ` Andy Shevchenko
2025-08-13 13:45 ` Dominique Martinet
2025-08-13 23:04 ` Paul E. McKenney
0 siblings, 2 replies; 9+ messages in thread
From: Andy Shevchenko @ 2025-08-13 13:39 UTC (permalink / raw)
To: Dominique Martinet
Cc: Nathan Chancellor, kernel test robot,
Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Christian Brauner, David Howells, Alexander Viro, Andrew Morton,
llvm, oe-kbuild-all, Linux Memory Management List,
Maximilian Bosch, Ryan Lahfa, Christian Theune, Arnout Engelen,
linux-kernel, linux-block, linux-fsdevel, stable
On Wed, Aug 13, 2025 at 02:34:25PM +0900, Dominique Martinet wrote:
> Nathan Chancellor wrote on Tue, Aug 12, 2025 at 10:16:33PM -0700:
> > > 1 warning generated.
> >
> > I see this in -next now, should remain be zero initialized or is there
> > some other fix that is needed?
>
> A zero-initialization is fine, I sent a v2 with zero-initialization
> fixed yesterday:
> https://lkml.kernel.org/r/20250812-iot_iter_folio-v2-1-f99423309478@codewreck.org
>
> (and I'll send a v3 with the goto replaced with a bigger if later today
> as per David's request)
>
> I assume Andrew will pick it up eventually?
I hope this to happen sooner as it broke my builds too (I always do now `make W=1`
and suggest all developers should follow).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-13 13:39 ` Andy Shevchenko
@ 2025-08-13 13:45 ` Dominique Martinet
2025-08-13 13:52 ` Andy Shevchenko
2025-08-13 23:04 ` Paul E. McKenney
1 sibling, 1 reply; 9+ messages in thread
From: Dominique Martinet @ 2025-08-13 13:45 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Nathan Chancellor, kernel test robot,
Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Christian Brauner, David Howells, Alexander Viro, Andrew Morton,
llvm, oe-kbuild-all, Linux Memory Management List,
Maximilian Bosch, Ryan Lahfa, Christian Theune, Arnout Engelen,
linux-kernel, linux-block, linux-fsdevel, stable
Andy Shevchenko wrote on Wed, Aug 13, 2025 at 03:39:09PM +0200:
> > I assume Andrew will pick it up eventually?
>
> I hope this to happen sooner as it broke my builds too (I always do now `make W=1`
> and suggest all developers should follow).
I actually test with W=1 too, but somehow this warning doesn't show up
in my build, I'm not quite sure why :/
(even if I try clang like the test robot... But there's plenty of
other warnings all around everywhere else, so I agree this is all way
too manual)
Anyway, sorry about it...
--
Dominique
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-13 5:16 ` Nathan Chancellor
2025-08-13 5:34 ` Dominique Martinet
@ 2025-08-13 13:49 ` David Howells
1 sibling, 0 replies; 9+ messages in thread
From: David Howells @ 2025-08-13 13:49 UTC (permalink / raw)
To: Dominique Martinet, Christian Brauner
Cc: dhowells, Nathan Chancellor, kernel test robot,
Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Alexander Viro, Andrew Morton, llvm, oe-kbuild-all,
Linux Memory Management List, Maximilian Bosch, Ryan Lahfa,
Christian Theune, Arnout Engelen, linux-kernel, linux-block,
linux-fsdevel, stable
Dominique Martinet <asmadeus@codewreck.org> wrote:
> I assume Andrew will pick it up eventually?
These might be more a Christian/VFS thing.
David
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-13 13:45 ` Dominique Martinet
@ 2025-08-13 13:52 ` Andy Shevchenko
2025-08-14 1:14 ` Dominique Martinet
0 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2025-08-13 13:52 UTC (permalink / raw)
To: Dominique Martinet
Cc: Nathan Chancellor, kernel test robot,
Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Christian Brauner, David Howells, Alexander Viro, Andrew Morton,
llvm, oe-kbuild-all, Linux Memory Management List,
Maximilian Bosch, Ryan Lahfa, Christian Theune, Arnout Engelen,
linux-kernel, linux-block, linux-fsdevel, stable
On Wed, Aug 13, 2025 at 10:45:33PM +0900, Dominique Martinet wrote:
> Andy Shevchenko wrote on Wed, Aug 13, 2025 at 03:39:09PM +0200:
> > > I assume Andrew will pick it up eventually?
> >
> > I hope this to happen sooner as it broke my builds too (I always do now `make W=1`
> > and suggest all developers should follow).
>
> I actually test with W=1 too, but somehow this warning doesn't show up
> in my build, I'm not quite sure why :/
> (even if I try clang like the test robot... But there's plenty of
> other warnings all around everywhere else, so I agree this is all way
> too manual)
Depends on your config, last few releases I was specifically targetting x86
defconfigs (32- and 64-bit) to be build with `make W=1`. There are a couple of
changes that are still pending, but otherwise it builds with GCC and clang.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-13 13:39 ` Andy Shevchenko
2025-08-13 13:45 ` Dominique Martinet
@ 2025-08-13 23:04 ` Paul E. McKenney
1 sibling, 0 replies; 9+ messages in thread
From: Paul E. McKenney @ 2025-08-13 23:04 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Dominique Martinet, Nathan Chancellor, kernel test robot,
Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Christian Brauner, David Howells, Alexander Viro, Andrew Morton,
llvm, oe-kbuild-all, Linux Memory Management List,
Maximilian Bosch, Ryan Lahfa, Christian Theune, Arnout Engelen,
linux-kernel, linux-block, linux-fsdevel, stable
On Wed, Aug 13, 2025 at 03:39:09PM +0200, Andy Shevchenko wrote:
> On Wed, Aug 13, 2025 at 02:34:25PM +0900, Dominique Martinet wrote:
> > Nathan Chancellor wrote on Tue, Aug 12, 2025 at 10:16:33PM -0700:
> > > > 1 warning generated.
> > >
> > > I see this in -next now, should remain be zero initialized or is there
> > > some other fix that is needed?
> >
> > A zero-initialization is fine, I sent a v2 with zero-initialization
> > fixed yesterday:
> > https://lkml.kernel.org/r/20250812-iot_iter_folio-v2-1-f99423309478@codewreck.org
> >
> > (and I'll send a v3 with the goto replaced with a bigger if later today
> > as per David's request)
> >
> > I assume Andrew will pick it up eventually?
>
> I hope this to happen sooner as it broke my builds too (I always do now `make W=1`
> and suggest all developers should follow).
This build failure is showing up in my testing as well.
In the service of preventing bisection issues, would it be possible to
fold the fix into the original patch?
Thanx, Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size
2025-08-13 13:52 ` Andy Shevchenko
@ 2025-08-14 1:14 ` Dominique Martinet
0 siblings, 0 replies; 9+ messages in thread
From: Dominique Martinet @ 2025-08-14 1:14 UTC (permalink / raw)
To: Andy Shevchenko, Paul E. McKenney
Cc: Nathan Chancellor, kernel test robot,
Dominique Martinet via B4 Relay, Matthew Wilcox (Oracle),
Christian Brauner, David Howells, Alexander Viro, Andrew Morton,
llvm, oe-kbuild-all, Linux Memory Management List,
Maximilian Bosch, Ryan Lahfa, Christian Theune, Arnout Engelen,
linux-kernel, linux-block, linux-fsdevel, stable
Andy Shevchenko wrote on Wed, Aug 13, 2025 at 04:52:39PM +0300:
> > I actually test with W=1 too, but somehow this warning doesn't show up
> > in my build, I'm not quite sure why :/
> > (even if I try clang like the test robot... But there's plenty of
> > other warnings all around everywhere else, so I agree this is all way
> > too manual)
>
> Depends on your config, last few releases I was specifically targetting x86
> defconfigs (32- and 64-bit) to be build with `make W=1`. There are a couple of
> changes that are still pending, but otherwise it builds with GCC and clang.
I meant it the other way around: the warning isn't showing up on master
+ these patches for my config.
But now I double-checked, 'CC=clang make W=1' doesn't actually use
clang, I should have tried 'make CC=clang W=1'...
And, yeah, it just doesn't show up with gcc so I'll know it's better to
check both compilers...
Paul E. McKenney wrote on Wed, Aug 13, 2025 at 04:04:19PM -0700:
> > I hope this to happen sooner as it broke my builds too (I always do now `make W=1`
> > and suggest all developers should follow).
>
> This build failure is showing up in my testing as well.
>
> In the service of preventing bisection issues, would it be possible to
> fold the fix into the original patch?
Andrew just picked v3 up, so there won't be any such problem, and -next
will stop failing after today's update
--
Dominique Martinet | Asmadeus
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-08-14 1:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250811-iot_iter_folio-v1-1-d9c223adf93c@codewreck.org>
2025-08-11 18:55 ` [PATCH 1/2] iov_iter: iterate_folioq: fix handling of offset >= folio size kernel test robot
2025-08-13 5:16 ` Nathan Chancellor
2025-08-13 5:34 ` Dominique Martinet
2025-08-13 13:39 ` Andy Shevchenko
2025-08-13 13:45 ` Dominique Martinet
2025-08-13 13:52 ` Andy Shevchenko
2025-08-14 1:14 ` Dominique Martinet
2025-08-13 23:04 ` Paul E. McKenney
2025-08-13 13:49 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).