summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-03-22 02:40:11 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-12 05:27:12 +0300
commit0504c074b546651f19f23a214b76d145d3a0f5af (patch)
tree321bc79030483e45273b88c1ce1d7708428db75e /fs
parent32a56afa23e157b444b6c2b943322ea0d119517b (diff)
downloadlinux-0504c074b546651f19f23a214b76d145d3a0f5af.tar.xz
switch {compat_,}do_readv_writev() to {compat_,}import_iovec()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/read_write.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 11980f164432..69128b378646 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -842,13 +842,14 @@ static ssize_t do_readv_writev(int type, struct file *file,
iov_fn_t fnv;
iter_fn_t iter_fn;
- ret = rw_copy_check_uvector(type, uvector, nr_segs,
- ARRAY_SIZE(iovstack), iovstack, &iov);
- if (ret <= 0)
- goto out;
- iov_iter_init(&iter, type, iov, nr_segs, ret);
+ ret = import_iovec(type, uvector, nr_segs,
+ ARRAY_SIZE(iovstack), &iov, &iter);
+ if (ret < 0)
+ return ret;
- tot_len = ret;
+ tot_len = iov_iter_count(&iter);
+ if (!tot_len)
+ goto out;
ret = rw_verify_area(type, file, pos, tot_len);
if (ret < 0)
goto out;
@@ -876,8 +877,7 @@ static ssize_t do_readv_writev(int type, struct file *file,
file_end_write(file);
out:
- if (iov != iovstack)
- kfree(iov);
+ kfree(iov);
if ((ret + (type == READ)) > 0) {
if (type == READ)
fsnotify_access(file);
@@ -1022,13 +1022,14 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
iov_fn_t fnv;
iter_fn_t iter_fn;
- ret = compat_rw_copy_check_uvector(type, uvector, nr_segs,
- UIO_FASTIOV, iovstack, &iov);
- if (ret <= 0)
- goto out;
- iov_iter_init(&iter, type, iov, nr_segs, ret);
+ ret = compat_import_iovec(type, uvector, nr_segs,
+ UIO_FASTIOV, &iov, &iter);
+ if (ret < 0)
+ return ret;
- tot_len = ret;
+ tot_len = iov_iter_count(&iter);
+ if (!tot_len)
+ goto out;
ret = rw_verify_area(type, file, pos, tot_len);
if (ret < 0)
goto out;
@@ -1056,8 +1057,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
file_end_write(file);
out:
- if (iov != iovstack)
- kfree(iov);
+ kfree(iov);
if ((ret + (type == READ)) > 0) {
if (type == READ)
fsnotify_access(file);