Patchwork wpan: use GFP_ATOMIC instead of GFP_KERNEL

login
register
mail settings
Submitter Eric Dumazet
Date Feb. 5, 2013, 6:20 p.m.
Message ID <1360088403.28557.6.camel@edumazet-glaptop>
Download mbox | patch
Permalink /patch/218313/
State RFC
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - Feb. 5, 2013, 6:20 p.m.
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 :



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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;
 }