tangled
alpha
login
or
join now
tjh.dev
/
kernel
1
fork
atom
Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1
fork
atom
overview
issues
pulls
pipelines
Merge branch 'iov_iter' into for-davem
Al Viro
11 years ago
fe3cce2e
237dae88
+71
2 changed files
expand all
collapse all
unified
split
include
linux
uio.h
lib
iov_iter.c
+14
include/linux/uio.h
reviewed
···
139
139
size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
140
140
size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
141
141
142
142
+
int import_iovec(int type, const struct iovec __user * uvector,
143
143
+
unsigned nr_segs, unsigned fast_segs,
144
144
+
struct iovec **iov, struct iov_iter *i);
145
145
+
146
146
+
#ifdef CONFIG_COMPAT
147
147
+
struct compat_iovec;
148
148
+
int compat_import_iovec(int type, const struct compat_iovec __user * uvector,
149
149
+
unsigned nr_segs, unsigned fast_segs,
150
150
+
struct iovec **iov, struct iov_iter *i);
151
151
+
#endif
152
152
+
153
153
+
int import_single_range(int type, void __user *buf, size_t len,
154
154
+
struct iovec *iov, struct iov_iter *i);
155
155
+
142
156
#endif
+57
lib/iov_iter.c
reviewed
···
766
766
flags);
767
767
}
768
768
EXPORT_SYMBOL(dup_iter);
769
769
+
770
770
+
int import_iovec(int type, const struct iovec __user * uvector,
771
771
+
unsigned nr_segs, unsigned fast_segs,
772
772
+
struct iovec **iov, struct iov_iter *i)
773
773
+
{
774
774
+
ssize_t n;
775
775
+
struct iovec *p;
776
776
+
n = rw_copy_check_uvector(type, uvector, nr_segs, fast_segs,
777
777
+
*iov, &p);
778
778
+
if (n < 0) {
779
779
+
if (p != *iov)
780
780
+
kfree(p);
781
781
+
*iov = NULL;
782
782
+
return n;
783
783
+
}
784
784
+
iov_iter_init(i, type, p, nr_segs, n);
785
785
+
*iov = p == *iov ? NULL : p;
786
786
+
return 0;
787
787
+
}
788
788
+
EXPORT_SYMBOL(import_iovec);
789
789
+
790
790
+
#ifdef CONFIG_COMPAT
791
791
+
#include <linux/compat.h>
792
792
+
793
793
+
int compat_import_iovec(int type, const struct compat_iovec __user * uvector,
794
794
+
unsigned nr_segs, unsigned fast_segs,
795
795
+
struct iovec **iov, struct iov_iter *i)
796
796
+
{
797
797
+
ssize_t n;
798
798
+
struct iovec *p;
799
799
+
n = compat_rw_copy_check_uvector(type, uvector, nr_segs, fast_segs,
800
800
+
*iov, &p);
801
801
+
if (n < 0) {
802
802
+
if (p != *iov)
803
803
+
kfree(p);
804
804
+
*iov = NULL;
805
805
+
return n;
806
806
+
}
807
807
+
iov_iter_init(i, type, p, nr_segs, n);
808
808
+
*iov = p == *iov ? NULL : p;
809
809
+
return 0;
810
810
+
}
811
811
+
#endif
812
812
+
813
813
+
int import_single_range(int rw, void __user *buf, size_t len,
814
814
+
struct iovec *iov, struct iov_iter *i)
815
815
+
{
816
816
+
if (len > MAX_RW_COUNT)
817
817
+
len = MAX_RW_COUNT;
818
818
+
if (unlikely(!access_ok(!rw, buf, len)))
819
819
+
return -EFAULT;
820
820
+
821
821
+
iov->iov_base = buf;
822
822
+
iov->iov_len = len;
823
823
+
iov_iter_init(i, rw, iov, 1, len);
824
824
+
return 0;
825
825
+
}