diff mbox

[SK_BUFF] : '< 0' and '>= 0' test on unsigned

Message ID 49BFA8EA.4000702@gmail.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

roel kluin March 17, 2009, 1:43 p.m. UTC
Was this patch missed?

struct sk_buff is located at vi include/linux/skbuff.h +357: 
maybe a different test is needed in x25_rx_call_request()?
------------------------------>8-------------8<---------------------------------
skb->len is an unsigned int, so the test in x25_rx_call_request() always
evaluates to true.

len in x25_sendmsg() is unsigned as well. so -ERRORS returned by x25_output()
are not noticed.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Arnaldo Carvalho de Melo March 17, 2009, 5:29 p.m. UTC | #1
Em Tue, Mar 17, 2009 at 02:43:06PM +0100, Roel Kluin escreveu:
> Was this patch missed?
> 
> struct sk_buff is located at vi include/linux/skbuff.h +357: 
> maybe a different test is needed in x25_rx_call_request()?
> ------------------------------>8-------------8<---------------------------------
> skb->len is an unsigned int, so the test in x25_rx_call_request() always
> evaluates to true.
> 
> len in x25_sendmsg() is unsigned as well. so -ERRORS returned by x25_output()
> are not noticed.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

I saw DaveM applying this one, lemme see...

http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commit;h=8db09f26f912f7c90c764806e804b558da520d4f

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 17, 2009, 7:25 p.m. UTC | #2
From: Roel Kluin <roel.kluin@gmail.com>
Date: Tue, 17 Mar 2009 14:43:06 +0100

> Was this patch missed?

It's in net-next-2.6, I'm not merging all of these trite
off-by-one fixes into net-2.6 so late in the release cycle.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 9fc5b02..c57a09f 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -951,10 +951,8 @@  int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
 	/*
 	 *	Incoming Call User Data.
 	 */
-	if (skb->len >= 0) {
-		skb_copy_from_linear_data(skb, makex25->calluserdata.cuddata, skb->len);
-		makex25->calluserdata.cudlength = skb->len;
-	}
+	skb_copy_from_linear_data(skb, makex25->calluserdata.cuddata, skb->len);
+	makex25->calluserdata.cudlength = skb->len;
 
 	sk->sk_ack_backlog++;
 
@@ -1122,8 +1120,9 @@  static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
 	if (msg->msg_flags & MSG_OOB)
 		skb_queue_tail(&x25->interrupt_out_queue, skb);
 	else {
-		len = x25_output(sk, skb);
-		if (len < 0)
+		rc = x25_output(sk, skb);
+		len = rc;
+		if (rc < 0)
 			kfree_skb(skb);
 		else if (x25->qbitincl)
 			len++;