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

* Re: [PATCH] [SK_BUFF]: '< 0' and '>= 0' test on unsigned
  2009-03-01 22:00 [PATCH] [SK_BUFF]: '< 0' and '>= 0' test on unsigned Roel Kluin
@ 2009-03-13 23:04 ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2009-03-13 23:04 UTC (permalink / raw)
  To: roel.kluin; +Cc: acme, netdev, akpm

From: Roel Kluin <roel.kluin@gmail.com>
Date: Sun, 01 Mar 2009 23:00:57 +0100

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

Applied to net-next-2.6, thanks.

^ permalink raw reply	[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

* Re: [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
  1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-03-17 17:29 UTC (permalink / raw)
  To: Roel Kluin; +Cc: acme, netdev, David S. Miller, Andrew Morton

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

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

* Re: [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
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2009-03-17 19:25 UTC (permalink / raw)
  To: roel.kluin; +Cc: acme, netdev, akpm

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.

^ permalink raw reply	[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).