[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150115214519.GB29656@ZenIV.linux.org.uk>
Date: Thu, 15 Jan 2015 21:45:20 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net
Subject: Re: [PATCH net-next] socket: use iov_length()
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@...nd.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?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists