Commit fc4e98db authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a07fdcec
...@@ -377,17 +377,14 @@ static int lowpan_header_create(struct sk_buff *skb, ...@@ -377,17 +377,14 @@ static int lowpan_header_create(struct sk_buff *skb,
struct ipv6hdr *hdr; struct ipv6hdr *hdr;
const u8 *saddr = _saddr; const u8 *saddr = _saddr;
const u8 *daddr = _daddr; const u8 *daddr = _daddr;
u8 *head; u8 head[100];
struct ieee802154_addr sa, da; struct ieee802154_addr sa, da;
if (type != ETH_P_IPV6)
return 0;
/* TODO: /* TODO:
* if this package isn't ipv6 one, where should it be routed? * if this package isn't ipv6 one, where should it be routed?
*/ */
head = kzalloc(100, GFP_KERNEL); if (type != ETH_P_IPV6)
if (head == NULL) return 0;
return -ENOMEM;
hdr = ipv6_hdr(skb); hdr = ipv6_hdr(skb);
hc06_ptr = head + 2; hc06_ptr = head + 2;
...@@ -561,8 +558,6 @@ static int lowpan_header_create(struct sk_buff *skb, ...@@ -561,8 +558,6 @@ static int lowpan_header_create(struct sk_buff *skb,
skb_pull(skb, sizeof(struct ipv6hdr)); skb_pull(skb, sizeof(struct ipv6hdr));
memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head); memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head);
kfree(head);
lowpan_raw_dump_table(__func__, "raw skb data dump", skb->data, lowpan_raw_dump_table(__func__, "raw skb data dump", skb->data,
skb->len); skb->len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment