mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-22 20:43:56 +08:00
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>
This commit is contained in:
parent
4e7a84b1a5
commit
7eb35b1483
12
net/socket.c
12
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;
|
||||
|
Loading…
Reference in New Issue
Block a user