Re: [PATCH v1] mm/truncate: fix the zeroing end of pagecache_isize_extended()

From: Brian Foster

Date: Tue Oct 20 2026 - 07:04:46 EST


On Mon, Oct 19, 2026 at 03:54:14PM -0400, Nickolai Zeldovich wrote:
> On Mon, Oct 19, 2026 at 3:35 PM Brian Foster <bfoster@xxxxxxxxxx> wrote:
> > > --- a/mm/truncate.c
> > > +++ b/mm/truncate.c
> > > @@ -878,8 +878,7 @@ void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to)
> > > unsigned int offset, end;
> > >
> > > offset = from - folio_pos(folio);
> > > - end = min_t(unsigned int, to - folio_pos(folio),
> > > - folio_size(folio));
> > > + end = min_t(loff_t, to - folio_pos(folio), folio_size(folio));
> >
> > Good catch...
> >
> > folio_size() returns size_t and folio_zero_segment() expects size_t for
> > the offset params. Perhaps we should that instead of loff_t?
>
> size_t is (unsigned int) on 32-bit machines, like i386, which has the
> same issue (reproducer from the patch).
>

Ah, Ok. So loff_t makes sense for the min_t(). I do still wonder if it
makes sense to switch offset and end to size_t while we're here though.

Brian