netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] socket: use iov_length()
@ 2015-01-14 10:07 Nicolas Dichtel
  2015-01-14 21:45 ` David Miller
  2015-01-15 21:45 ` [PATCH net-next] " Al Viro
  0 siblings, 2 replies; 8+ messages in thread
From: Nicolas Dichtel @ 2015-01-14 10:07 UTC (permalink / raw)
  To: netdev; +Cc: davem, Nicolas Dichtel

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);
 
 	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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-18  4:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).