diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2015-01-15 10:35:58 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-15 13:56:15 -0500 |
commit | 7eb35b148305c6f86a6bc5818c29f79e0d45146c (patch) | |
tree | bb196b77d758c25556f58565ad663f2c8568ca3e /net/socket.c | |
parent | 4e7a84b1a5bc8094522fd11f628b00c4b4e78b4d (diff) | |
download | lwn-7eb35b148305c6f86a6bc5818c29f79e0d45146c.tar.gz lwn-7eb35b148305c6f86a6bc5818c29f79e0d45146c.zip |
socket: use iov_length()
Better to use available helpers.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/net/socket.c b/net/socket.c index a2c33a4dc7ba..e1278d7e1d5d 100644 --- a/net/socket.c +++ b/net/socket.c @@ -882,11 +882,7 @@ static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb, unsigned long nr_segs) { 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_t size = iov_length(iov, nr_segs); msg->msg_name = NULL; msg->msg_namelen = 0; @@ -921,11 +917,7 @@ static ssize_t do_sock_write(struct msghdr *msg, struct kiocb *iocb, unsigned long nr_segs) { 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_t size = iov_length(iov, nr_segs); msg->msg_name = NULL; msg->msg_namelen = 0; |