All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: David Cohen <david.a.cohen@linux.intel.com>
Cc: balbi@ti.com, gregkh@linuxfoundation.org, mina86@mina86.com,
	r.baldyga@samsung.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Subject: Re: [PATCH v2] usb: ffs: fix regression when quirk_ep_out_aligned_size flag is set
Date: Sun, 12 Oct 2014 20:12:28 +0100	[thread overview]
Message-ID: <20141012191228.GR7996@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1412802738-28839-1-git-send-email-david.a.cohen@linux.intel.com>

On Wed, Oct 08, 2014 at 02:12:18PM -0700, David Cohen wrote:
>  		use_mm(io_data->mm);
>  		for (i = 0; i < io_data->nr_segs; i++) {
> +			size_t len = min_t(size_t, ret - pos,
> +					io_data->iovec[i].iov_len);
> +			if (!len)
> +				break;
>  			if (unlikely(copy_to_user(io_data->iovec[i].iov_base,
> -						 &io_data->buf[pos],
> -						 io_data->iovec[i].iov_len))) {
> +						 &io_data->buf[pos], len))) {
>  				ret = -EFAULT;
>  				break;
>  			}
> -			pos += io_data->iovec[i].iov_len;
> +			pos += len;

Hmm...  This is really asking for something like
	if (copy_to_iter(io_data->buf, ret, <something>) != ret)
		ret = -EFAULT;
with <something> being an iov_iter instead of iovec.  It would be really
nice to have that thing switched to ->read_iter/->write_iter, dropping
->read/->write/->aio_read/->aio_write; I'm not familiar enough with that
code to do it on my own, though, so it would require some help from
maintainers...

  reply	other threads:[~2014-10-12 19:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08  0:18 [PATCH] usb: ffs: fix regression when quirk_ep_out_aligned_size flag is set David Cohen
2014-10-08  0:31 ` Felipe Balbi
2014-10-08 17:53   ` David Cohen
2014-10-08  0:32 ` Felipe Balbi
2014-10-08 17:55   ` David Cohen
2014-10-08 19:54     ` Felipe Balbi
2014-10-08 11:34 ` Michal Nazarewicz
2014-10-08 21:12 ` [PATCH v2] " David Cohen
2014-10-12 19:12   ` Al Viro [this message]
2014-10-12 19:58     ` Felipe Balbi
2014-10-13 15:32   ` Felipe Balbi
2014-10-13 16:55     ` David Cohen
2014-10-13 17:03       ` Felipe Balbi
2014-10-13 18:15   ` [PATCH v3] " David Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141012191228.GR7996@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=balbi@ti.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    --cc=qiuxu.zhuo@intel.com \
    --cc=r.baldyga@samsung.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.