From: Al Viro <viro@ZenIV.linux.org.uk>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH net-next] socket: use iov_length()
Date: Thu, 15 Jan 2015 21:45:20 +0000 [thread overview]
Message-ID: <20150115214519.GB29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1421230070-4104-1-git-send-email-nicolas.dichtel@6wind.com>
On Wed, Jan 14, 2015 at 11:07:50AM +0100, Nicolas Dichtel wrote:
> Better to use available helpers.
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> net/socket.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/socket.c b/net/socket.c
> index a2c33a4dc7ba..b1f3fa4da020 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -883,10 +883,8 @@ static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb,
> {
> struct socket *sock = file->private_data;
> size_t size = 0;
> - int i;
>
> - for (i = 0; i < nr_segs; i++)
> - size += iov[i].iov_len;
> + size = iov_length(iov, nr_segs);
What's wrong with size = iocb->ki_nbytes instead of calling anything?
next prev parent reply other threads:[~2015-01-15 21:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 10:07 [PATCH net-next] socket: use iov_length() Nicolas Dichtel
2015-01-14 21:45 ` David Miller
2015-01-15 9:35 ` [PATCH net-next v2] " Nicolas Dichtel
2015-01-15 18:57 ` David Miller
2015-01-15 21:45 ` Al Viro [this message]
2015-01-16 13:31 ` [PATCH net-next] " Nicolas Dichtel
2015-01-16 13:35 ` [PATCH net-next] socket: use ki_nbytes instead of iov_length() Nicolas Dichtel
2015-01-18 4:58 ` David Miller
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=20150115214519.GB29656@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).