On Fri, Aug 2, 2024 at 10:39 AM Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx> wrote: > Calculating the size of the mapped area as the lesser value > between the requested size and the actual size does not consider > the partial mapping offset. This can cause page fault access. > > Fix the calculation of the starting and ending addresses, the > total size is now deduced from the difference between the end and > start addresses. > > Additionally, the calculations have been rewritten in a clearer > and more understandable form. > > Fixes: c58305af1835 ("drm/i915: Use remap_io_mapping() to prefault all PTE in a single pass") > Reported-by: Jann Horn <jannh@xxxxxxxxxx> > Co-developed-by: Chris Wilson <chris.p.wilson@xxxxxxxxxxxxxxx> > Signed-off-by: Chris Wilson <chris.p.wilson@xxxxxxxxxxxxxxx> > Signed-off-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx> > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > Cc: Matthew Auld <matthew.auld@xxxxxxxxx> > Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> # v4.9+ Reviewed-by: Jann Horn <jannh@xxxxxxxxxx>