aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/umem.c
diff options
context:
space:
mode:
authorShiraz Saleem <shiraz.saleem@intel.com>2019-04-04 10:22:47 -0500
committerJason Gunthorpe <jgg@mellanox.com>2019-04-08 13:05:25 -0300
commitd0b5c01bb446f87e94265b172c00f4e89829116d (patch)
tree0c8c764b7b0f8f84e8f7498b149ce0be6711f99f /drivers/infiniband/core/umem.c
parentRDMA/hns: Dump detailed driver-specific CQ (diff)
downloadlinux-dev-d0b5c01bb446f87e94265b172c00f4e89829116d.tar.xz
linux-dev-d0b5c01bb446f87e94265b172c00f4e89829116d.zip
RDMA/umem: Use correct value for SG entries in sg_copy_to_buffer()
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>
Diffstat (limited to 'drivers/infiniband/core/umem.c')
-rw-r--r--drivers/infiniband/core/umem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index d31f5e386c7d..7e912a91ec8e 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -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;