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

Alon Levy alevy at redhat.com
Fri Feb 17 11:25:38 PST 2012


On Fri, Feb 17, 2012 at 01:08:42PM +0100, Paolo Bonzini wrote:
> 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.

ok, thanks for the explanation. so ACK.

> 
> Paolo
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list