aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2013-02-05 05:23:43 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-06 15:56:17 -0500
commitfc4e98dbbaa30ca2180df0b2b0d0608045ed3f19 (patch)
treeb8a555d561dfae5ac96cae94c4a8d9f19f7a75d6 /net/ieee802154
parenta07fdceccf9d9f1b87f781e9a87662182e590d70 (diff)
6lowpan: use stack buffer instead of heap
head buffer is only temporary available in lowpan_header_create. So it's not necessary to put it on the heap. Also fixed a comment codestyle issue. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/6lowpan.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index f62c3b963f95..43b95ca61114 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -377,17 +377,14 @@ static int lowpan_header_create(struct sk_buff *skb,
377 struct ipv6hdr *hdr; 377 struct ipv6hdr *hdr;
378 const u8 *saddr = _saddr; 378 const u8 *saddr = _saddr;
379 const u8 *daddr = _daddr; 379 const u8 *daddr = _daddr;
380 u8 *head; 380 u8 head[100];
381 struct ieee802154_addr sa, da; 381 struct ieee802154_addr sa, da;
382 382
383 /* TODO:
384 * if this package isn't ipv6 one, where should it be routed?
385 */
383 if (type != ETH_P_IPV6) 386 if (type != ETH_P_IPV6)
384 return 0; 387 return 0;
385 /* TODO:
386 * if this package isn't ipv6 one, where should it be routed?
387 */
388 head = kzalloc(100, GFP_KERNEL);
389 if (head == NULL)
390 return -ENOMEM;
391 388
392 hdr = ipv6_hdr(skb); 389 hdr = ipv6_hdr(skb);
393 hc06_ptr = head + 2; 390 hc06_ptr = head + 2;
@@ -561,8 +558,6 @@ static int lowpan_header_create(struct sk_buff *skb,
561 skb_pull(skb, sizeof(struct ipv6hdr)); 558 skb_pull(skb, sizeof(struct ipv6hdr));
562 memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head); 559 memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head);
563 560
564 kfree(head);
565
566 lowpan_raw_dump_table(__func__, "raw skb data dump", skb->data, 561 lowpan_raw_dump_table(__func__, "raw skb data dump", skb->data,
567 skb->len); 562 skb->len);
568 563