提交 25060d8f 编写于 作者: A Alexander Aring 提交者: David S. Miller

wpan: use stack buffer instead of heap

head buffer is only temporary available in mac802154_header_create.
So it's not necessary to put it on the heap.
Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fc4e98db
...@@ -137,16 +137,12 @@ static int mac802154_header_create(struct sk_buff *skb, ...@@ -137,16 +137,12 @@ static int mac802154_header_create(struct sk_buff *skb,
struct ieee802154_addr dev_addr; struct ieee802154_addr dev_addr;
struct mac802154_sub_if_data *priv = netdev_priv(dev); struct mac802154_sub_if_data *priv = netdev_priv(dev);
int pos = 2; int pos = 2;
u8 *head; u8 head[MAC802154_FRAME_HARD_HEADER_LEN];
u16 fc; u16 fc;
if (!daddr) if (!daddr)
return -EINVAL; return -EINVAL;
head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL);
if (head == NULL)
return -ENOMEM;
head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */ head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */
fc = mac_cb_type(skb); fc = mac_cb_type(skb);
...@@ -210,7 +206,6 @@ static int mac802154_header_create(struct sk_buff *skb, ...@@ -210,7 +206,6 @@ static int mac802154_header_create(struct sk_buff *skb,
head[1] = fc >> 8; head[1] = fc >> 8;
memcpy(skb_push(skb, pos), head, pos); memcpy(skb_push(skb, pos), head, pos);
kfree(head);
return pos; return pos;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册