netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [SK_BUFF]: '< 0' and '>= 0' test on unsigned
@ 2009-03-01 22:00 Roel Kluin
  2009-03-13 23:04 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2009-03-01 22:00 UTC (permalink / raw)
  To: acme; +Cc: netdev, David S. Miller, Andrew Morton

struct sk_buff is located at vi include/linux/skbuff.h +357: 
maybe a different test is needed in x25_rx_call_request()?

This patch wasn't tested in any way.
------------------------------>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>
---
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++;

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] [SK_BUFF]: '< 0' and '>= 0' test on unsigned
@ 2009-03-17 13:43 Roel Kluin
  2009-03-17 17:29 ` Arnaldo Carvalho de Melo
  2009-03-17 19:25 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Roel Kluin @ 2009-03-17 13:43 UTC (permalink / raw)
  To: acme; +Cc: netdev, David S. Miller, Andrew Morton

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>
---
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++;


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-17 19:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-01 22:00 [PATCH] [SK_BUFF]: '< 0' and '>= 0' test on unsigned Roel Kluin
2009-03-13 23:04 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2009-03-17 13:43 Roel Kluin
2009-03-17 17:29 ` Arnaldo Carvalho de Melo
2009-03-17 19:25 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).