Skip to content

Commit d4690f1

Browse files
Al Virotorvalds
authored andcommitted
fix iov_iter_fault_in_readable()
... by turning it into what used to be multipages counterpart Cc: [email protected] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f32a10d commit d4690f1

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

include/linux/uio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
7676
struct iov_iter *i, unsigned long offset, size_t bytes);
7777
void iov_iter_advance(struct iov_iter *i, size_t bytes);
7878
int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
79-
int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes);
79+
#define iov_iter_fault_in_multipages_readable iov_iter_fault_in_readable
8080
size_t iov_iter_single_seg_count(const struct iov_iter *i);
8181
size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
8282
struct iov_iter *i);

lib/iov_iter.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -290,34 +290,14 @@ static size_t copy_page_from_iter_iovec(struct page *page, size_t offset, size_t
290290
return wanted - bytes;
291291
}
292292

293-
/*
294-
* Fault in the first iovec of the given iov_iter, to a maximum length
295-
* of bytes. Returns 0 on success, or non-zero if the memory could not be
296-
* accessed (ie. because it is an invalid address).
297-
*
298-
* writev-intensive code may want this to prefault several iovecs -- that
299-
* would be possible (callers must not rely on the fact that _only_ the
300-
* first iovec will be faulted with the current implementation).
301-
*/
302-
int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes)
303-
{
304-
if (!(i->type & (ITER_BVEC|ITER_KVEC))) {
305-
char __user *buf = i->iov->iov_base + i->iov_offset;
306-
bytes = min(bytes, i->iov->iov_len - i->iov_offset);
307-
return fault_in_pages_readable(buf, bytes);
308-
}
309-
return 0;
310-
}
311-
EXPORT_SYMBOL(iov_iter_fault_in_readable);
312-
313293
/*
314294
* Fault in one or more iovecs of the given iov_iter, to a maximum length of
315295
* bytes. For each iovec, fault in each page that constitutes the iovec.
316296
*
317297
* Return 0 on success, or non-zero if the memory could not be accessed (i.e.
318298
* because it is an invalid address).
319299
*/
320-
int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes)
300+
int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes)
321301
{
322302
size_t skip = i->iov_offset;
323303
const struct iovec *iov;
@@ -334,7 +314,7 @@ int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes)
334314
}
335315
return 0;
336316
}
337-
EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable);
317+
EXPORT_SYMBOL(iov_iter_fault_in_readable);
338318

339319
void iov_iter_init(struct iov_iter *i, int direction,
340320
const struct iovec *iov, unsigned long nr_segs,

0 commit comments

Comments
 (0)