Skip to content

Commit

Permalink
IB/ipath: Fix user memory region creation when IOMMU present
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bryan O'Sullivan authored and Roland Dreier committed Apr 19, 2007
1 parent 946db67 commit 165c552
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/infiniband/hw/ipath/ipath_mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 165c552

Please sign in to comment.