From patchwork Tue Feb 5 20:23:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] wpan: use stack buffer instead of heap Date: Tue, 05 Feb 2013 10:23:44 -0000 From: Alexander Aring X-Patchwork-Id: 218335 Message-Id: <1360095824-12538-3-git-send-email-alex.aring@gmail.com> To: alex.bluesman.smirnov@gmail.com Cc: dbaryshkov@gmail.com, linux-zigbee-devel@lists.sourceforge.net, davem@davemloft.net, netdev@vger.kernel.org, Alexander Aring head buffer is only temporary available in mac802154_header_create. So it's not necessary to put it on the heap. Signed-off-by: Alexander Aring --- net/mac802154/wpan.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 98c867b..d20c6d3 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; }