Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 118654
b: refs/heads/master
c: c2c0b4c
h: refs/heads/master
v: v3
  • Loading branch information
Maciej Sosnowski authored and David S. Miller committed Nov 10, 2008
1 parent 83d081a commit b9cb8a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3d4f44f50b65b0b0290e357f8739cfb3f4bcaca
refs/heads/master: c2c0b4c5434c0a25f7f7796b29155d53805909f5
17 changes: 6 additions & 11 deletions trunk/drivers/dma/iovlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
int nr_iovecs = 0;
int iovec_len_used = 0;
int iovec_pages_used = 0;
long err;

/* don't pin down non-user-based iovecs */
if (segment_eq(get_fs(), KERNEL_DS))
Expand All @@ -72,23 +71,21 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
local_list = kmalloc(sizeof(*local_list)
+ (nr_iovecs * sizeof (struct dma_page_list))
+ (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL);
if (!local_list) {
err = -ENOMEM;
if (!local_list)
goto out;
}

/* list of pages starts right after the page list array */
pages = (struct page **) &local_list->page_list[nr_iovecs];

local_list->nr_iovecs = 0;

for (i = 0; i < nr_iovecs; i++) {
struct dma_page_list *page_list = &local_list->page_list[i];

len -= iov[i].iov_len;

if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len)) {
err = -EFAULT;
if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len))
goto unpin;
}

page_list->nr_pages = num_pages_spanned(&iov[i]);
page_list->base_address = iov[i].iov_base;
Expand All @@ -109,10 +106,8 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
NULL);
up_read(&current->mm->mmap_sem);

if (ret != page_list->nr_pages) {
err = -ENOMEM;
if (ret != page_list->nr_pages)
goto unpin;
}

local_list->nr_iovecs = i + 1;
}
Expand All @@ -122,7 +117,7 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
unpin:
dma_unpin_iovec_pages(local_list);
out:
return ERR_PTR(err);
return NULL;
}

void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)
Expand Down

0 comments on commit b9cb8a3

Please sign in to comment.