]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/umem: Use correct value for SG entries in sg_copy_to_buffer()
authorShiraz Saleem <shiraz.saleem@intel.com>
Thu, 4 Apr 2019 15:22:47 +0000 (10:22 -0500)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 8 Apr 2019 16:05:25 +0000 (13:05 -0300)
With page combining, the assumption that number of SG entries in umem SGL
equal to number of system pages in umem no longer holds.

umem->sg_nents tracks the SG entries in umem SGL. Use it in
sg_pcopy_to_buffer() as opposed to ib_umem_num_pages(umem).

Fixes: d10bcf947a3e ("RDMA/umem: Combine contiguous PAGE_SIZE regions in SGEs")
Reported-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/umem.c

index d31f5e386c7d63691c018b14ab0ed01917cca797..7e912a91ec8eae8af240dd6cd4791e97abd78842 100644 (file)
@@ -381,8 +381,8 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset,
                return -EINVAL;
        }
 
-       ret = sg_pcopy_to_buffer(umem->sg_head.sgl, ib_umem_num_pages(umem),
-                                dst, length, offset + ib_umem_offset(umem));
+       ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->sg_nents, dst, length,
+                                offset + ib_umem_offset(umem));
 
        if (ret < 0)
                return ret;