aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac802154/wpan.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 98c867bca986..d20c6d3c247d 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -137,16 +137,12 @@ static int mac802154_header_create(struct sk_buff *skb,
137 struct ieee802154_addr dev_addr; 137 struct ieee802154_addr dev_addr;
138 struct mac802154_sub_if_data *priv = netdev_priv(dev); 138 struct mac802154_sub_if_data *priv = netdev_priv(dev);
139 int pos = 2; 139 int pos = 2;
140 u8 *head; 140 u8 head[MAC802154_FRAME_HARD_HEADER_LEN];
141 u16 fc; 141 u16 fc;
142 142
143 if (!daddr) 143 if (!daddr)
144 return -EINVAL; 144 return -EINVAL;
145 145
146 head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL);
147 if (head == NULL)
148 return -ENOMEM;
149
150 head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */ 146 head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */
151 fc = mac_cb_type(skb); 147 fc = mac_cb_type(skb);
152 148
@@ -210,7 +206,6 @@ static int mac802154_header_create(struct sk_buff *skb,
210 head[1] = fc >> 8; 206 head[1] = fc >> 8;
211 207
212 memcpy(skb_push(skb, pos), head, pos); 208 memcpy(skb_push(skb, pos), head, pos);
213 kfree(head);
214 209
215 return pos; 210 return pos;
216} 211}