mm/gup: Fix some contiguous memmap assumptions
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 7 Jan 2022 18:25:55 +0000 (13:25 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 17 Feb 2022 22:05:51 +0000 (17:05 -0500)
commitf701d40e8b70c3102d81a2c590dd35c99672e9bf
treed6838fd78ecd599a89430c4fe1840ce9e5482ed9
parent7369d128ad036d747d59f3313915568481f8b354
mm/gup: Fix some contiguous memmap assumptions

Several functions in gup.c assume that a compound page has virtually
contiguous page structs.  This isn't true for SPARSEMEM configs unless
SPARSEMEM_VMEMMAP is also set.  Fix them by using nth_page() instead of
plain pointer arithmetic.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
mm/gup.c