[Spice-devel] [PATCH 6/7] Respect IOV_MAX if defined

Paolo Bonzini pbonzini at redhat.com
Fri Feb 17 04:08:42 PST 2012


On 02/17/2012 10:08 AM, Alon Levy wrote:
> Isn't this another candidate for ifdeferry?

It actually applies to Linux too, except that IOV_MAX is 1024.

See in fs/read_write.c

709 static ssize_t do_readv_writev(int type, struct file *file,
710                                const struct iovec __user * uvector,
711                                unsigned long nr_segs, loff_t *pos)
712 {
...
725         ret = rw_copy_check_uvector(type, uvector, nr_segs,
726                                     ARRAY_SIZE(iovstack), iovstack, &iov, 1);

...


633 ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
634                               unsigned long nr_segs, unsigned long fast_segs,
635                               struct iovec *fast_pointer,
636                               struct iovec **ret_pointer,
637                               int check_access)
638 {
...
657         if (nr_segs > UIO_MAXIOV) {
658                 ret = -EINVAL;
659                 goto out;
660         }

...


and in linux/uio.h:

 26 #define UIO_FASTIOV     8
 27 #define UIO_MAXIOV      1024
 28 

which matches IOV_MAX.

Paolo


More information about the Spice-devel mailing list