iov: add import_ubuf()
Like import_single_range(), but for ITER_UBUF. Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
b7bfaa761d
commit
2ad9bd8332
@ -346,6 +346,7 @@ ssize_t __import_iovec(int type, const struct iovec __user *uvec,
|
||||
struct iov_iter *i, bool compat);
|
||||
int import_single_range(int type, void __user *buf, size_t len,
|
||||
struct iovec *iov, struct iov_iter *i);
|
||||
int import_ubuf(int type, void __user *buf, size_t len, struct iov_iter *i);
|
||||
|
||||
static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,
|
||||
void __user *buf, size_t count)
|
||||
|
@ -1877,6 +1877,17 @@ int import_single_range(int rw, void __user *buf, size_t len,
|
||||
}
|
||||
EXPORT_SYMBOL(import_single_range);
|
||||
|
||||
int import_ubuf(int rw, void __user *buf, size_t len, struct iov_iter *i)
|
||||
{
|
||||
if (len > MAX_RW_COUNT)
|
||||
len = MAX_RW_COUNT;
|
||||
if (unlikely(!access_ok(buf, len)))
|
||||
return -EFAULT;
|
||||
|
||||
iov_iter_ubuf(i, rw, buf, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* iov_iter_restore() - Restore a &struct iov_iter to the same state as when
|
||||
* iov_iter_save_state() was called.
|
||||
|
Loading…
Reference in New Issue
Block a user