tcp: fix a size_t < 0 comparison in tcp_read_sock
Subsystems (3)
PATCH RESEND 1/1 tcp: fix a size_t < 0 comparison in tcp_read_sock
Discovered it while testing this patch:
http://www.spinics.net/lists/netdev/msg64668.html
(in this case, tcp_read_sock breaks; but regardless of that patch I think we should have this one)
Thanks,
tavi
commit 6cf0a9254f0b7fc41781a2cacd5a8b312a4b1e70
Author: Octavian Purdila <[email protected]> Date: Wed Jul 2 21:25:51 2008 +0300
tcp: fix a size_t < 0 comparison in tcp_read_sock
<used> should be of type int (not size_t) since recv_actor can return negative values and it is also used in a < 0 comparison.
net/ipv4/tcp.c +2 -1
@@ -1208,7 +1208,8 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,return -ENOTCONN ;while ((skb =tcp_recv_skb (sk, seq, &offset)) !=NULL ) {if (offset < skb->len) { -size_t used, len; +int used; +size_t len; len = skb->len - offset;/* Stop reading if we hit a patch of urgent data */
From: Octavian Purdila <[email protected]>
Date: Wed, 2 Jul 2008 21:57:53 +0300
Quoted 7 lines
Discovered it while testing this patch:
http://www.spinics.net/lists/netdev/msg64668.html
(in this case,
tcp_read_sockbreaks; but regardless of that patch I think we should have this one)
Applied, thanks a lot!