All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag
@ 2014-10-06  9:00 Alexander Aring
  2014-10-06  9:00 ` [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder Alexander Aring
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alexander Aring @ 2014-10-06  9:00 UTC (permalink / raw)
  To: linux-wpan; +Cc: marcel, Alexander Aring

This patch fix byteorder issues with fragment tag of generation 802.15.4
6LoWPAN fragment header.

net/ieee802154/6lowpan_rtnl.c:278:54: warning restricted __be16 degrades to integer
net/ieee802154/6lowpan_rtnl.c:278:18: warning: incorrect type in assignment (different base types)
net/ieee802154/6lowpan_rtnl.c:278:18:    expected restricted __be16 [usertype] frag_tag
net/ieee802154/6lowpan_rtnl.c:278:18:    got unsigned short

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/ieee802154/6lowpan_rtnl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index 4413629..8631206 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -63,7 +63,7 @@ static LIST_HEAD(lowpan_devices);
 struct lowpan_dev_info {
 	struct net_device	*real_dev; /* real WPAN device ptr */
 	struct mutex		dev_list_mtx; /* mutex for list ops */
-	__be16			fragment_tag;
+	u16			fragment_tag;
 };
 
 struct lowpan_dev_record {
@@ -275,7 +275,8 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
 
 	dgram_size = lowpan_uncompress_size(skb, &dgram_offset) -
 		     skb->mac_len;
-	frag_tag = lowpan_dev_info(dev)->fragment_tag++;
+	frag_tag = htons(lowpan_dev_info(dev)->fragment_tag);
+	lowpan_dev_info(dev)->fragment_tag++;
 
 	frag_hdr[0] = LOWPAN_DISPATCH_FRAG1 | ((dgram_size >> 8) & 0x07);
 	frag_hdr[1] = dgram_size & 0xff;
@@ -294,7 +295,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
 				  frag_len + skb_network_header_len(skb));
 	if (rc) {
 		pr_debug("%s unable to send FRAG1 packet (tag: %d)",
-			 __func__, frag_tag);
+			 __func__, ntohs(frag_tag));
 		goto err;
 	}
 
@@ -315,7 +316,7 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *dev,
 					  frag_len);
 		if (rc) {
 			pr_debug("%s unable to send a FRAGN packet. (tag: %d, offset: %d)\n",
-				 __func__, frag_tag, skb_offset);
+				 __func__, ntohs(frag_tag), skb_offset);
 			goto err;
 		}
 	} while (skb_unprocessed > frag_cap);
-- 
2.1.2


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

* [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder
  2014-10-06  9:00 [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Alexander Aring
@ 2014-10-06  9:00 ` Alexander Aring
  2014-10-06 10:42   ` Marcel Holtmann
  2014-10-06  9:00 ` [PATCH wpan-next 3/3] ieee802154: 6lowpan: fix sign of errno return val Alexander Aring
  2014-10-06 10:42 ` [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Marcel Holtmann
  2 siblings, 1 reply; 8+ messages in thread
From: Alexander Aring @ 2014-10-06  9:00 UTC (permalink / raw)
  To: linux-wpan; +Cc: marcel, Alexander Aring

This patch fix byte order handling in reassembly code of 802.15.4
6LoWPAN fragmentation handling.

net/ieee802154/reassembly.c:58:43: warning: restricted __be16 degrades to integer

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/ieee802154/reassembly.c | 8 +++++---
 net/ieee802154/reassembly.h | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c
index 32755cb..43c4163 100644
--- a/net/ieee802154/reassembly.c
+++ b/net/ieee802154/reassembly.c
@@ -33,7 +33,7 @@
 static const char lowpan_frags_cache_name[] = "lowpan-frags";
 
 struct lowpan_frag_info {
-	__be16 d_tag;
+	u16 d_tag;
 	u16 d_size;
 	u8 d_offset;
 };
@@ -48,7 +48,7 @@ static struct inet_frags lowpan_frags;
 static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
 			     struct sk_buff *prev, struct net_device *dev);
 
-static unsigned int lowpan_hash_frag(__be16 tag, u16 d_size,
+static unsigned int lowpan_hash_frag(u16 tag, u16 d_size,
 				     const struct ieee802154_addr *saddr,
 				     const struct ieee802154_addr *daddr)
 {
@@ -330,11 +330,13 @@ static int lowpan_get_frag_info(struct sk_buff *skb, const u8 frag_type,
 {
 	bool fail;
 	u8 pattern = 0, low = 0;
+	__be16 d_tag = 0;
 
 	fail = lowpan_fetch_skb(skb, &pattern, 1);
 	fail |= lowpan_fetch_skb(skb, &low, 1);
 	frag_info->d_size = (pattern & 7) << 8 | low;
-	fail |= lowpan_fetch_skb(skb, &frag_info->d_tag, 2);
+	fail |= lowpan_fetch_skb(skb, &d_tag, 2);
+	frag_info->d_tag = ntohs(d_tag);
 
 	if (frag_type == LOWPAN_DISPATCH_FRAGN) {
 		fail |= lowpan_fetch_skb(skb, &frag_info->d_offset, 1);
diff --git a/net/ieee802154/reassembly.h b/net/ieee802154/reassembly.h
index 74e4a7c..836b16f 100644
--- a/net/ieee802154/reassembly.h
+++ b/net/ieee802154/reassembly.h
@@ -4,7 +4,7 @@
 #include <net/inet_frag.h>
 
 struct lowpan_create_arg {
-	__be16 tag;
+	u16 tag;
 	u16 d_size;
 	const struct ieee802154_addr *src;
 	const struct ieee802154_addr *dst;
@@ -15,7 +15,7 @@ struct lowpan_create_arg {
 struct lowpan_frag_queue {
 	struct inet_frag_queue	q;
 
-	__be16			tag;
+	u16			tag;
 	u16			d_size;
 	struct ieee802154_addr	saddr;
 	struct ieee802154_addr	daddr;
-- 
2.1.2


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

* [PATCH wpan-next 3/3] ieee802154: 6lowpan: fix sign of errno return val
  2014-10-06  9:00 [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Alexander Aring
  2014-10-06  9:00 ` [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder Alexander Aring
@ 2014-10-06  9:00 ` Alexander Aring
  2014-10-06 10:42   ` Marcel Holtmann
  2014-10-06 10:42 ` [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Marcel Holtmann
  2 siblings, 1 reply; 8+ messages in thread
From: Alexander Aring @ 2014-10-06  9:00 UTC (permalink / raw)
  To: linux-wpan; +Cc: marcel, Alexander Aring

This patch fix ERR_PTR(-rc) to ERR_PTR(rc). The variable rc is already a
negative errno value.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/ieee802154/6lowpan_rtnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index 8631206..45c3977 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -233,7 +233,7 @@ lowpan_alloc_frag(struct sk_buff *skb, int size,
 				     &master_hdr->source, size);
 		if (rc < 0) {
 			kfree_skb(frag);
-			return ERR_PTR(-rc);
+			return ERR_PTR(rc);
 		}
 	} else {
 		frag = ERR_PTR(-ENOMEM);
-- 
2.1.2


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

* Re: [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder
  2014-10-06  9:00 ` [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder Alexander Aring
@ 2014-10-06 10:42   ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2014-10-06 10:42 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan

Hi Alex,

> This patch fix byte order handling in reassembly code of 802.15.4
> 6LoWPAN fragmentation handling.
> 
> net/ieee802154/reassembly.c:58:43: warning: restricted __be16 degrades to integer
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> Reported-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/ieee802154/reassembly.c | 8 +++++---
> net/ieee802154/reassembly.h | 4 ++--
> 2 files changed, 7 insertions(+), 5 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag
  2014-10-06  9:00 [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Alexander Aring
  2014-10-06  9:00 ` [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder Alexander Aring
  2014-10-06  9:00 ` [PATCH wpan-next 3/3] ieee802154: 6lowpan: fix sign of errno return val Alexander Aring
@ 2014-10-06 10:42 ` Marcel Holtmann
  2014-10-06 11:22   ` Alexander Aring
  2 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2014-10-06 10:42 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan

Hi Alex,

> This patch fix byteorder issues with fragment tag of generation 802.15.4
> 6LoWPAN fragment header.
> 
> net/ieee802154/6lowpan_rtnl.c:278:54: warning restricted __be16 degrades to integer
> net/ieee802154/6lowpan_rtnl.c:278:18: warning: incorrect type in assignment (different base types)
> net/ieee802154/6lowpan_rtnl.c:278:18:    expected restricted __be16 [usertype] frag_tag
> net/ieee802154/6lowpan_rtnl.c:278:18:    got unsigned short
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> Reported-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/ieee802154/6lowpan_rtnl.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH wpan-next 3/3] ieee802154: 6lowpan: fix sign of errno return val
  2014-10-06  9:00 ` [PATCH wpan-next 3/3] ieee802154: 6lowpan: fix sign of errno return val Alexander Aring
@ 2014-10-06 10:42   ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2014-10-06 10:42 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan

Hi Alex,

> This patch fix ERR_PTR(-rc) to ERR_PTR(rc). The variable rc is already a
> negative errno value.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> net/ieee802154/6lowpan_rtnl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag
  2014-10-06 10:42 ` [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Marcel Holtmann
@ 2014-10-06 11:22   ` Alexander Aring
  2014-10-06 12:56     ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Aring @ 2014-10-06 11:22 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-wpan

Hi Marcel,

On Mon, Oct 06, 2014 at 12:42:15PM +0200, Marcel Holtmann wrote:
> Hi Alex,
> 
> > This patch fix byteorder issues with fragment tag of generation 802.15.4
> > 6LoWPAN fragment header.
> > 
> > net/ieee802154/6lowpan_rtnl.c:278:54: warning restricted __be16 degrades to integer
> > net/ieee802154/6lowpan_rtnl.c:278:18: warning: incorrect type in assignment (different base types)
> > net/ieee802154/6lowpan_rtnl.c:278:18:    expected restricted __be16 [usertype] frag_tag
> > net/ieee802154/6lowpan_rtnl.c:278:18:    got unsigned short
> > 
> > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > Reported-by: Marcel Holtmann <marcel@holtmann.org>
> > ---
> > net/ieee802154/6lowpan_rtnl.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> 
> patch has been applied to bluetooth-next tree.
> 

mhhh, I thought I should apply these patches to wpan-next three. That's
why it's tagged with "wpan-next" and sent to linux-wpan only.

Just for global review and such things...

Then I will send it with a bunch of patches to linux-bluetooth (I should
change that to send pull-requests to you).

- Alex

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

* Re: [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag
  2014-10-06 11:22   ` Alexander Aring
@ 2014-10-06 12:56     ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2014-10-06 12:56 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan

Hi Alex,

>>> This patch fix byteorder issues with fragment tag of generation 802.15.4
>>> 6LoWPAN fragment header.
>>> 
>>> net/ieee802154/6lowpan_rtnl.c:278:54: warning restricted __be16 degrades to integer
>>> net/ieee802154/6lowpan_rtnl.c:278:18: warning: incorrect type in assignment (different base types)
>>> net/ieee802154/6lowpan_rtnl.c:278:18:    expected restricted __be16 [usertype] frag_tag
>>> net/ieee802154/6lowpan_rtnl.c:278:18:    got unsigned short
>>> 
>>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>>> Reported-by: Marcel Holtmann <marcel@holtmann.org>
>>> ---
>>> net/ieee802154/6lowpan_rtnl.c | 9 +++++----
>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>> 
>> patch has been applied to bluetooth-next tree.
>> 
> 
> mhhh, I thought I should apply these patches to wpan-next three. That's
> why it's tagged with "wpan-next" and sent to linux-wpan only.
> 
> Just for global review and such things...
> 
> Then I will send it with a bunch of patches to linux-bluetooth (I should
> change that to send pull-requests to you).

if you want to send pull requests to me that is fine as well. Right now I take patches into bluetooth-next so that they get global exposure and we get them into wireless-next on a regular basis.

I am totally fine with just applying patches one by one. That is no extra work for me. I just want to get them into the tree so that they will make it into wireless-next early on.

Regards

Marcel


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

end of thread, other threads:[~2014-10-06 12:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-06  9:00 [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Alexander Aring
2014-10-06  9:00 ` [PATCH wpan-next 2/3] ieee802154: reassembly: fix tag byteorder Alexander Aring
2014-10-06 10:42   ` Marcel Holtmann
2014-10-06  9:00 ` [PATCH wpan-next 3/3] ieee802154: 6lowpan: fix sign of errno return val Alexander Aring
2014-10-06 10:42   ` Marcel Holtmann
2014-10-06 10:42 ` [PATCH wpan-next 1/3] ieee802154: 6lowpan: fix byteorder for frag tag Marcel Holtmann
2014-10-06 11:22   ` Alexander Aring
2014-10-06 12:56     ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.