From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH net-next] socket: use iov_length()
Date: Fri, 16 Jan 2015 14:31:54 +0100 [thread overview]
Message-ID: <54B912CA.40305@6wind.com> (raw)
In-Reply-To: <20150115214519.GB29656@ZenIV.linux.org.uk>
Le 15/01/2015 22:45, Al Viro a écrit :
> 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?
>
I'm not an expert, but it seems you're right. I will send a patch.
next prev parent reply other threads:[~2015-01-16 13:31 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 ` [PATCH net-next] " Al Viro
2015-01-16 13:31 ` Nicolas Dichtel [this message]
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=54B912CA.40305@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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.