[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1421230070-4104-1-git-send-email-nicolas.dichtel@6wind.com>
Date: Wed, 14 Jan 2015 11:07:50 +0100
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, Nicolas Dichtel <nicolas.dichtel@...nd.com>
Subject: [PATCH net-next] socket: use iov_length()
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);
msg->msg_name = NULL;
msg->msg_namelen = 0;
@@ -922,10 +920,8 @@ static ssize_t do_sock_write(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);
msg->msg_name = NULL;
msg->msg_namelen = 0;
--
2.1.0
--
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