aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/datagram.c2
-rw-r--r--net/ipv4/tcp.c8
-rw-r--r--net/rxrpc/ar-output.c19
-rw-r--r--net/socket.c4
4 files changed, 16 insertions, 17 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c
index df493d68330c..b80fb91bb3f7 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -673,7 +673,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
673 if (!chunk) 673 if (!chunk)
674 return 0; 674 return 0;
675 675
676 if (iov_iter_count(&msg->msg_iter) < chunk) { 676 if (msg_data_left(msg) < chunk) {
677 if (__skb_checksum_complete(skb)) 677 if (__skb_checksum_complete(skb))
678 goto csum_error; 678 goto csum_error;
679 if (skb_copy_datagram_msg(skb, hlen, msg, chunk)) 679 if (skb_copy_datagram_msg(skb, hlen, msg, chunk))
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 094a6822c71d..18e3a12eb1b2 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1119,7 +1119,7 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
1119 1119
1120 sg = !!(sk->sk_route_caps & NETIF_F_SG); 1120 sg = !!(sk->sk_route_caps & NETIF_F_SG);
1121 1121
1122 while (iov_iter_count(&msg->msg_iter)) { 1122 while (msg_data_left(msg)) {
1123 int copy = 0; 1123 int copy = 0;
1124 int max = size_goal; 1124 int max = size_goal;
1125 1125
@@ -1163,8 +1163,8 @@ new_segment:
1163 } 1163 }
1164 1164
1165 /* Try to append data to the end of skb. */ 1165 /* Try to append data to the end of skb. */
1166 if (copy > iov_iter_count(&msg->msg_iter)) 1166 if (copy > msg_data_left(msg))
1167 copy = iov_iter_count(&msg->msg_iter); 1167 copy = msg_data_left(msg);
1168 1168
1169 /* Where to copy to? */ 1169 /* Where to copy to? */
1170 if (skb_availroom(skb) > 0) { 1170 if (skb_availroom(skb) > 0) {
@@ -1221,7 +1221,7 @@ new_segment:
1221 tcp_skb_pcount_set(skb, 0); 1221 tcp_skb_pcount_set(skb, 0);
1222 1222
1223 copied += copy; 1223 copied += copy;
1224 if (!iov_iter_count(&msg->msg_iter)) { 1224 if (!msg_data_left(msg)) {
1225 tcp_tx_timestamp(sk, skb); 1225 tcp_tx_timestamp(sk, skb);
1226 goto out; 1226 goto out;
1227 } 1227 }
diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c
index 7a31a3958364..c0042807bfc6 100644
--- a/net/rxrpc/ar-output.c
+++ b/net/rxrpc/ar-output.c
@@ -564,8 +564,8 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
564 max &= ~(call->conn->size_align - 1UL); 564 max &= ~(call->conn->size_align - 1UL);
565 565
566 chunk = max; 566 chunk = max;
567 if (chunk > iov_iter_count(&msg->msg_iter) && !more) 567 if (chunk > msg_data_left(msg) && !more)
568 chunk = iov_iter_count(&msg->msg_iter); 568 chunk = msg_data_left(msg);
569 569
570 space = chunk + call->conn->size_align; 570 space = chunk + call->conn->size_align;
571 space &= ~(call->conn->size_align - 1UL); 571 space &= ~(call->conn->size_align - 1UL);
@@ -608,11 +608,11 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
608 sp = rxrpc_skb(skb); 608 sp = rxrpc_skb(skb);
609 609
610 /* append next segment of data to the current buffer */ 610 /* append next segment of data to the current buffer */
611 if (iov_iter_count(&msg->msg_iter) > 0) { 611 if (msg_data_left(msg) > 0) {
612 int copy = skb_tailroom(skb); 612 int copy = skb_tailroom(skb);
613 ASSERTCMP(copy, >, 0); 613 ASSERTCMP(copy, >, 0);
614 if (copy > iov_iter_count(&msg->msg_iter)) 614 if (copy > msg_data_left(msg))
615 copy = iov_iter_count(&msg->msg_iter); 615 copy = msg_data_left(msg);
616 if (copy > sp->remain) 616 if (copy > sp->remain)
617 copy = sp->remain; 617 copy = sp->remain;
618 618
@@ -633,7 +633,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
633 633
634 /* add the packet to the send queue if it's now full */ 634 /* add the packet to the send queue if it's now full */
635 if (sp->remain <= 0 || 635 if (sp->remain <= 0 ||
636 (iov_iter_count(&msg->msg_iter) == 0 && !more)) { 636 (msg_data_left(msg) == 0 && !more)) {
637 struct rxrpc_connection *conn = call->conn; 637 struct rxrpc_connection *conn = call->conn;
638 uint32_t seq; 638 uint32_t seq;
639 size_t pad; 639 size_t pad;
@@ -663,7 +663,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
663 sp->hdr.serviceId = conn->service_id; 663 sp->hdr.serviceId = conn->service_id;
664 664
665 sp->hdr.flags = conn->out_clientflag; 665 sp->hdr.flags = conn->out_clientflag;
666 if (iov_iter_count(&msg->msg_iter) == 0 && !more) 666 if (msg_data_left(msg) == 0 && !more)
667 sp->hdr.flags |= RXRPC_LAST_PACKET; 667 sp->hdr.flags |= RXRPC_LAST_PACKET;
668 else if (CIRC_SPACE(call->acks_head, call->acks_tail, 668 else if (CIRC_SPACE(call->acks_head, call->acks_tail,
669 call->acks_winsz) > 1) 669 call->acks_winsz) > 1)
@@ -679,11 +679,10 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
679 679
680 memcpy(skb->head, &sp->hdr, 680 memcpy(skb->head, &sp->hdr,
681 sizeof(struct rxrpc_header)); 681 sizeof(struct rxrpc_header));
682 rxrpc_queue_packet(call, skb, 682 rxrpc_queue_packet(call, skb, !msg_data_left(msg) && !more);
683 iov_iter_count(&msg->msg_iter) == 0 && !more);
684 skb = NULL; 683 skb = NULL;
685 } 684 }
686 } while (iov_iter_count(&msg->msg_iter) > 0); 685 } while (msg_data_left(msg) > 0);
687 686
688success: 687success:
689 ret = copied; 688 ret = copied;
diff --git a/net/socket.c b/net/socket.c
index 21676e469b13..5b0126234606 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -612,7 +612,7 @@ EXPORT_SYMBOL(__sock_tx_timestamp);
612 612
613static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) 613static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
614{ 614{
615 int ret = sock->ops->sendmsg(sock, msg, iov_iter_count(&msg->msg_iter)); 615 int ret = sock->ops->sendmsg(sock, msg, msg_data_left(msg));
616 BUG_ON(ret == -EIOCBQUEUED); 616 BUG_ON(ret == -EIOCBQUEUED);
617 return ret; 617 return ret;
618} 618}
@@ -620,7 +620,7 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
620int sock_sendmsg(struct socket *sock, struct msghdr *msg) 620int sock_sendmsg(struct socket *sock, struct msghdr *msg)
621{ 621{
622 int err = security_socket_sendmsg(sock, msg, 622 int err = security_socket_sendmsg(sock, msg,
623 iov_iter_count(&msg->msg_iter)); 623 msg_data_left(msg));
624 624
625 return err ?: sock_sendmsg_nosec(sock, msg); 625 return err ?: sock_sendmsg_nosec(sock, msg);
626} 626}