From: Nicolas Dichtel Date: Thu, 15 Jan 2015 09:35:58 +0000 (+0100) Subject: socket: use iov_length() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7eb35b148305c6f86a6bc5818c29f79e0d45146c;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git socket: use iov_length() Better to use available helpers. Signed-off-by: Nicolas Dichtel Signed-off-by: David S. Miller --- 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;