On Tue, 15 Jul 2025 00:34:12 +0200 Klara Modin <klarasmodin@xxxxxxxxx> wrote: > iocb->ki_pos is loff_t (long long) while pgoff_t is unsigned long and > this overflow seems to happen in practice, resulting in last_index being > before index. > > The following diff resolves the issue for me: > > diff --git a/mm/filemap.c b/mm/filemap.c > index 3c071307f40e..d2902be0b845 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -2585,8 +2585,8 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, > int err = 0; > > /* "last_index" is the index of the folio beyond the end of the read */ > - last_index = round_up(iocb->ki_pos + count, mapping_min_folio_nrbytes(mapping)); > - last_index >>= PAGE_SHIFT; > + last_index = round_up(iocb->ki_pos + count, > + mapping_min_folio_nrbytes(mapping)) >> PAGE_SHIFT; > retry: > if (fatal_signal_pending(current)) > return -EINTR; Looks good, thanks. I added your signed-off-by (which I trust is OK?) and queued this up.