Re: [PATCH v1] mm/truncate: fix the zeroing end of pagecache_isize_extended()
From: Nickolai Zeldovich
Date: Mon Oct 19 2026 - 15:54:42 EST
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).
Nickolai.