]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
IB/umem: Fix use of npages/nmap fields
authorArtemy Kovalyov <artemyko@mellanox.com>
Tue, 14 Nov 2017 12:51:59 +0000 (14:51 +0200)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:33:51 +0000 (21:33 -0400)
[ Upstream commit edf1a84fe37c51290e2c88154ecaf48dadff3d27 ]

In ib_umem structure npages holds original number of sg entries, while
nmap is number of DMA blocks returned by dma_map_sg.

Fixes: c5d76f130b28 ('IB/core: Add umem function to read data from user-space')
Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/infiniband/core/umem.c

index 38acb3cfc545f91658f0d465b69914de99f281b2..bda76b9cf396691172e0c320b4b9703ba7cb719a 100644 (file)
@@ -352,7 +352,7 @@ 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, umem->nmap, dst, length,
+       ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->npages, dst, length,
                                 offset + ib_umem_offset(umem));
 
        if (ret < 0)