aboutsummaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-03-21 19:40:11 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:27:12 -0400
commit0504c074b546651f19f23a214b76d145d3a0f5af (patch)
tree321bc79030483e45273b88c1ce1d7708428db75e /fs/read_write.c
parent32a56afa23e157b444b6c2b943322ea0d119517b (diff)
switch {compat_,}do_readv_writev() to {compat_,}import_iovec()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/read_write.c')
-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,
842 iov_fn_t fnv; 842 iov_fn_t fnv;
843 iter_fn_t iter_fn; 843 iter_fn_t iter_fn;
844 844
845 ret = rw_copy_check_uvector(type, uvector, nr_segs, 845 ret = import_iovec(type, uvector, nr_segs,
846 ARRAY_SIZE(iovstack), iovstack, &iov); 846 ARRAY_SIZE(iovstack), &iov, &iter);
847 if (ret <= 0) 847 if (ret < 0)
848 goto out; 848 return ret;
849 iov_iter_init(&iter, type, iov, nr_segs, ret);
850 849
851 tot_len = ret; 850 tot_len = iov_iter_count(&iter);
851 if (!tot_len)
852 goto out;
852 ret = rw_verify_area(type, file, pos, tot_len); 853 ret = rw_verify_area(type, file, pos, tot_len);
853 if (ret < 0) 854 if (ret < 0)
854 goto out; 855 goto out;
@@ -876,8 +877,7 @@ static ssize_t do_readv_writev(int type, struct file *file,
876 file_end_write(file); 877 file_end_write(file);
877 878
878out: 879out:
879 if (iov != iovstack) 880 kfree(iov);
880 kfree(iov);
881 if ((ret + (type == READ)) > 0) { 881 if ((ret + (type == READ)) > 0) {
882 if (type == READ) 882 if (type == READ)
883 fsnotify_access(file); 883 fsnotify_access(file);
@@ -1022,13 +1022,14 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
1022 iov_fn_t fnv; 1022 iov_fn_t fnv;
1023 iter_fn_t iter_fn; 1023 iter_fn_t iter_fn;
1024 1024
1025 ret = compat_rw_copy_check_uvector(type, uvector, nr_segs, 1025 ret = compat_import_iovec(type, uvector, nr_segs,
1026 UIO_FASTIOV, iovstack, &iov); 1026 UIO_FASTIOV, &iov, &iter);
1027 if (ret <= 0) 1027 if (ret < 0)
1028 goto out; 1028 return ret;
1029 iov_iter_init(&iter, type, iov, nr_segs, ret);
1030 1029
1031 tot_len = ret; 1030 tot_len = iov_iter_count(&iter);
1031 if (!tot_len)
1032 goto out;
1032 ret = rw_verify_area(type, file, pos, tot_len); 1033 ret = rw_verify_area(type, file, pos, tot_len);
1033 if (ret < 0) 1034 if (ret < 0)
1034 goto out; 1035 goto out;
@@ -1056,8 +1057,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
1056 file_end_write(file); 1057 file_end_write(file);
1057 1058
1058out: 1059out:
1059 if (iov != iovstack) 1060 kfree(iov);
1060 kfree(iov);
1061 if ((ret + (type == READ)) > 0) { 1061 if ((ret + (type == READ)) > 0) {
1062 if (type == READ) 1062 if (type == READ)
1063 fsnotify_access(file); 1063 fsnotify_access(file);