Commit 7eb35b14 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

socket: use iov_length()

Better to use available helpers.
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4e7a84b1
...@@ -882,11 +882,7 @@ static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb, ...@@ -882,11 +882,7 @@ static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb,
unsigned long nr_segs) unsigned long nr_segs)
{ {
struct socket *sock = file->private_data; struct socket *sock = file->private_data;
size_t size = 0; size_t size = iov_length(iov, nr_segs);
int i;
for (i = 0; i < nr_segs; i++)
size += iov[i].iov_len;
msg->msg_name = NULL; msg->msg_name = NULL;
msg->msg_namelen = 0; msg->msg_namelen = 0;
...@@ -921,11 +917,7 @@ static ssize_t do_sock_write(struct msghdr *msg, struct kiocb *iocb, ...@@ -921,11 +917,7 @@ static ssize_t do_sock_write(struct msghdr *msg, struct kiocb *iocb,
unsigned long nr_segs) unsigned long nr_segs)
{ {
struct socket *sock = file->private_data; struct socket *sock = file->private_data;
size_t size = 0; size_t size = iov_length(iov, nr_segs);
int i;
for (i = 0; i < nr_segs; i++)
size += iov[i].iov_len;
msg->msg_name = NULL; msg->msg_name = NULL;
msg->msg_namelen = 0; msg->msg_namelen = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment