aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/iov_iter.c27
-rw-r--r--mm/process_vm_access.c6
2 files changed, 1 insertions, 32 deletions
diff --git a/mm/iov_iter.c b/mm/iov_iter.c
index 10e46cd721de..22ec1ef068a8 100644
--- a/mm/iov_iter.c
+++ b/mm/iov_iter.c
@@ -129,33 +129,6 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
129} 129}
130EXPORT_SYMBOL(iov_iter_copy_from_user_atomic); 130EXPORT_SYMBOL(iov_iter_copy_from_user_atomic);
131 131
132/*
133 * This has the same sideeffects and return value as
134 * iov_iter_copy_from_user_atomic().
135 * The difference is that it attempts to resolve faults.
136 * Page must not be locked.
137 */
138size_t iov_iter_copy_from_user(struct page *page,
139 struct iov_iter *i, unsigned long offset, size_t bytes)
140{
141 char *kaddr;
142 size_t copied;
143
144 kaddr = kmap(page);
145 if (likely(i->nr_segs == 1)) {
146 int left;
147 char __user *buf = i->iov->iov_base + i->iov_offset;
148 left = __copy_from_user(kaddr + offset, buf, bytes);
149 copied = bytes - left;
150 } else {
151 copied = __iovec_copy_from_user_inatomic(kaddr + offset,
152 i->iov, i->iov_offset, bytes);
153 }
154 kunmap(page);
155 return copied;
156}
157EXPORT_SYMBOL(iov_iter_copy_from_user);
158
159void iov_iter_advance(struct iov_iter *i, size_t bytes) 132void iov_iter_advance(struct iov_iter *i, size_t bytes)
160{ 133{
161 BUG_ON(i->count < bytes); 134 BUG_ON(i->count < bytes);
diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c
index 8505c9262b35..f32b1fbbfe69 100644
--- a/mm/process_vm_access.c
+++ b/mm/process_vm_access.c
@@ -46,11 +46,7 @@ static int process_vm_rw_pages(struct page **pages,
46 copy = len; 46 copy = len;
47 47
48 if (vm_write) { 48 if (vm_write) {
49 if (copy > iov_iter_count(iter)) 49 copied = copy_page_from_iter(page, offset, copy, iter);
50 copy = iov_iter_count(iter);
51 copied = iov_iter_copy_from_user(page, iter,
52 offset, copy);
53 iov_iter_advance(iter, copied);
54 set_page_dirty_lock(page); 50 set_page_dirty_lock(page);
55 } else { 51 } else {
56 copied = copy_page_to_iter(page, offset, copy, iter); 52 copied = copy_page_to_iter(page, offset, copy, iter);