6lowpan: use stack buffer instead of heap
authorAlexander Aring <alex.aring@gmail.com>
Tue, 5 Feb 2013 10:23:43 +0000 (10:23 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Feb 2013 20:56:17 +0000 (15:56 -0500)
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>
net/ieee802154/6lowpan.c

index f62c3b963f9564457e0073c2f1ecc23d27aec54d..43b95ca611144920333ca6aa12bc70aa14c033b9 100644 (file)
@@ -377,17 +377,14 @@ static int lowpan_header_create(struct sk_buff *skb,
        struct ipv6hdr *hdr;
        const u8 *saddr = _saddr;
        const u8 *daddr = _daddr;
-       u8 *head;
+       u8 head[100];
        struct ieee802154_addr sa, da;
 
+       /* TODO:
+        * if this package isn't ipv6 one, where should it be routed?
+        */
        if (type != ETH_P_IPV6)
                return 0;
-               /* TODO:
-                * if this package isn't ipv6 one, where should it be routed?
-                */
-       head = kzalloc(100, GFP_KERNEL);
-       if (head == NULL)
-               return -ENOMEM;
 
        hdr = ipv6_hdr(skb);
        hc06_ptr = head + 2;
@@ -561,8 +558,6 @@ static int lowpan_header_create(struct sk_buff *skb,
        skb_pull(skb, sizeof(struct ipv6hdr));
        memcpy(skb_push(skb, hc06_ptr - head), head, hc06_ptr - head);
 
-       kfree(head);
-
        lowpan_raw_dump_table(__func__, "raw skb data dump", skb->data,
                                skb->len);
 
This page took 0.025731 seconds and 5 git commands to generate.