summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_mr.c
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2007-03-15 14:44:46 -0700
committerRoland Dreier <rolandd@cisco.com>2007-04-18 20:20:54 -0700
commit165c552c35052284e8ec4f7e9c027dfd33490e2c (patch)
tree7b35088520eebb8ae5ac22654d41247f36ddec5b /drivers/infiniband/hw/ipath/ipath_mr.c
parent946db67fbf836af30835d610b914cdde0cf467f8 (diff)
downloadop-kernel-dev-165c552c35052284e8ec4f7e9c027dfd33490e2c.zip
op-kernel-dev-165c552c35052284e8ec4f7e9c027dfd33490e2c.tar.gz
IB/ipath: Fix user memory region creation when IOMMU present
The loop which initializes the user memory region from an array of pages was using the wrong limit for the array. This worked OK when dma_map_sg() returned the same number as the number of pages. This patch fixes the problem. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_mr.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_mr.c b/drivers/infiniband/hw/ipath/ipath_mr.c
index 8cc8598..31e7073 100644
--- a/drivers/infiniband/hw/ipath/ipath_mr.c
+++ b/drivers/infiniband/hw/ipath/ipath_mr.c
@@ -210,9 +210,15 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
m = 0;
n = 0;
list_for_each_entry(chunk, &region->chunk_list, list) {
- for (i = 0; i < chunk->nmap; i++) {
- mr->mr.map[m]->segs[n].vaddr =
- page_address(chunk->page_list[i].page);
+ for (i = 0; i < chunk->nents; i++) {
+ void *vaddr;
+
+ vaddr = page_address(chunk->page_list[i].page);
+ if (!vaddr) {
+ ret = ERR_PTR(-EINVAL);
+ goto bail;
+ }
+ mr->mr.map[m]->segs[n].vaddr = vaddr;
mr->mr.map[m]->segs[n].length = region->page_size;
n++;
if (n == IPATH_SEGSZ) {
OpenPOWER on IntegriCloud