On Tue, 2013-02-05 at 19:00 +0100, Alexander Aring wrote:

> I don't know how I can do that. head is a temp buffer.
> At the end of this function stands:
> 
> memcpy(skb_push(skb, pos), head, pos)
> 
> and 'pos' is determined at runtime. skb_push will add data to the
> start of buffer, so head buffer will be at the start of skb. I don't
> know where I should manipulate the skb buffer at beginning of this function.

Please try :

diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 199b922..d18f2ac 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -137,16 +137,12 @@ static int mac802154_header_create(struct sk_buff *skb,
        struct ieee802154_addr dev_addr;
        struct mac802154_sub_if_data *priv = netdev_priv(dev);
        int pos = 2;
-       u8 *head;
+       u8 head[MAC802154_FRAME_HARD_HEADER_LEN];
        u16 fc;
 
        if (!daddr)
                return -EINVAL;
 
-       head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL);
-       if (head == NULL)
-               return -ENOMEM;
-
        head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */
        fc = mac_cb_type(skb);
 
@@ -210,7 +206,6 @@ static int mac802154_header_create(struct sk_buff *skb,
        head[1] = fc >> 8;
 
        memcpy(skb_push(skb, pos), head, pos);
-       kfree(head);
 
        return pos;
 }



------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to