Commit 480402e18def5514c9dc8cb04e3c0e7482ff2b86

Authored by Al Viro
1 parent ec69557982

untangling process_vm_..., part 1

we want to massage it to use of iov_iter.  This one is an equivalent
transformation - just introduce a local variable mirroring
lvec + *lvec_current.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 9 additions and 5 deletions Side-by-side Diff

mm/process_vm_access.c
... ... @@ -60,6 +60,7 @@
60 60 int ret;
61 61 ssize_t bytes_to_copy;
62 62 ssize_t rc = 0;
  63 + const struct iovec *iov = lvec + *lvec_current;
63 64  
64 65 *bytes_copied = 0;
65 66  
66 67  
... ... @@ -81,8 +82,10 @@
81 82 pgs_copied++) {
82 83 /* Make sure we have a non zero length iovec */
83 84 while (*lvec_current < lvec_cnt
84   - && lvec[*lvec_current].iov_len == 0)
  85 + && iov->iov_len == 0) {
  86 + iov++;
85 87 (*lvec_current)++;
  88 + }
86 89 if (*lvec_current == lvec_cnt)
87 90 break;
88 91  
89 92  
90 93  
... ... @@ -94,18 +97,18 @@
94 97 bytes_to_copy = min_t(ssize_t, PAGE_SIZE - start_offset,
95 98 len - *bytes_copied);
96 99 bytes_to_copy = min_t(ssize_t, bytes_to_copy,
97   - lvec[*lvec_current].iov_len
  100 + iov->iov_len
98 101 - *lvec_offset);
99 102  
100 103 target_kaddr = kmap(process_pages[pgs_copied]) + start_offset;
101 104  
102 105 if (vm_write)
103 106 ret = copy_from_user(target_kaddr,
104   - lvec[*lvec_current].iov_base
  107 + iov->iov_base
105 108 + *lvec_offset,
106 109 bytes_to_copy);
107 110 else
108   - ret = copy_to_user(lvec[*lvec_current].iov_base
  111 + ret = copy_to_user(iov->iov_base
109 112 + *lvec_offset,
110 113 target_kaddr, bytes_to_copy);
111 114 kunmap(process_pages[pgs_copied]);
112 115  
... ... @@ -117,12 +120,13 @@
117 120 }
118 121 *bytes_copied += bytes_to_copy;
119 122 *lvec_offset += bytes_to_copy;
120   - if (*lvec_offset == lvec[*lvec_current].iov_len) {
  123 + if (*lvec_offset == iov->iov_len) {
121 124 /*
122 125 * Need to copy remaining part of page into the
123 126 * next iovec if there are any bytes left in page
124 127 */
125 128 (*lvec_current)++;
  129 + iov++;
126 130 *lvec_offset = 0;
127 131 start_offset = (start_offset + bytes_to_copy)
128 132 % PAGE_SIZE;