diff options
Diffstat (limited to 'mm/iov_iter.c')
-rw-r--r-- | mm/iov_iter.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mm/iov_iter.c b/mm/iov_iter.c index 7b5dbd1517b5..ab88dc0ea1d3 100644 --- a/mm/iov_iter.c +++ b/mm/iov_iter.c | |||
@@ -310,7 +310,7 @@ void iov_iter_init(struct iov_iter *i, int direction, | |||
310 | EXPORT_SYMBOL(iov_iter_init); | 310 | EXPORT_SYMBOL(iov_iter_init); |
311 | 311 | ||
312 | static ssize_t get_pages_iovec(struct iov_iter *i, | 312 | static ssize_t get_pages_iovec(struct iov_iter *i, |
313 | struct page **pages, size_t maxsize, | 313 | struct page **pages, unsigned maxpages, |
314 | size_t *start) | 314 | size_t *start) |
315 | { | 315 | { |
316 | size_t offset = i->iov_offset; | 316 | size_t offset = i->iov_offset; |
@@ -323,10 +323,10 @@ static ssize_t get_pages_iovec(struct iov_iter *i, | |||
323 | len = iov->iov_len - offset; | 323 | len = iov->iov_len - offset; |
324 | if (len > i->count) | 324 | if (len > i->count) |
325 | len = i->count; | 325 | len = i->count; |
326 | if (len > maxsize) | ||
327 | len = maxsize; | ||
328 | addr = (unsigned long)iov->iov_base + offset; | 326 | addr = (unsigned long)iov->iov_base + offset; |
329 | len += *start = addr & (PAGE_SIZE - 1); | 327 | len += *start = addr & (PAGE_SIZE - 1); |
328 | if (len > maxpages * PAGE_SIZE) | ||
329 | len = maxpages * PAGE_SIZE; | ||
330 | addr &= ~(PAGE_SIZE - 1); | 330 | addr &= ~(PAGE_SIZE - 1); |
331 | n = (len + PAGE_SIZE - 1) / PAGE_SIZE; | 331 | n = (len + PAGE_SIZE - 1) / PAGE_SIZE; |
332 | res = get_user_pages_fast(addr, n, (i->type & WRITE) != WRITE, pages); | 332 | res = get_user_pages_fast(addr, n, (i->type & WRITE) != WRITE, pages); |
@@ -588,15 +588,14 @@ static unsigned long alignment_bvec(const struct iov_iter *i) | |||
588 | } | 588 | } |
589 | 589 | ||
590 | static ssize_t get_pages_bvec(struct iov_iter *i, | 590 | static ssize_t get_pages_bvec(struct iov_iter *i, |
591 | struct page **pages, size_t maxsize, | 591 | struct page **pages, unsigned maxpages, |
592 | size_t *start) | 592 | size_t *start) |
593 | { | 593 | { |
594 | const struct bio_vec *bvec = i->bvec; | 594 | const struct bio_vec *bvec = i->bvec; |
595 | size_t len = bvec->bv_len - i->iov_offset; | 595 | size_t len = bvec->bv_len - i->iov_offset; |
596 | if (len > i->count) | 596 | if (len > i->count) |
597 | len = i->count; | 597 | len = i->count; |
598 | if (len > maxsize) | 598 | /* can't be more than PAGE_SIZE */ |
599 | len = maxsize; | ||
600 | *start = bvec->bv_offset + i->iov_offset; | 599 | *start = bvec->bv_offset + i->iov_offset; |
601 | 600 | ||
602 | get_page(*pages = bvec->bv_page); | 601 | get_page(*pages = bvec->bv_page); |
@@ -712,13 +711,13 @@ unsigned long iov_iter_alignment(const struct iov_iter *i) | |||
712 | EXPORT_SYMBOL(iov_iter_alignment); | 711 | EXPORT_SYMBOL(iov_iter_alignment); |
713 | 712 | ||
714 | ssize_t iov_iter_get_pages(struct iov_iter *i, | 713 | ssize_t iov_iter_get_pages(struct iov_iter *i, |
715 | struct page **pages, size_t maxsize, | 714 | struct page **pages, unsigned maxpages, |
716 | size_t *start) | 715 | size_t *start) |
717 | { | 716 | { |
718 | if (i->type & ITER_BVEC) | 717 | if (i->type & ITER_BVEC) |
719 | return get_pages_bvec(i, pages, maxsize, start); | 718 | return get_pages_bvec(i, pages, maxpages, start); |
720 | else | 719 | else |
721 | return get_pages_iovec(i, pages, maxsize, start); | 720 | return get_pages_iovec(i, pages, maxpages, start); |
722 | } | 721 | } |
723 | EXPORT_SYMBOL(iov_iter_get_pages); | 722 | EXPORT_SYMBOL(iov_iter_get_pages); |
724 | 723 | ||