skbuff/mac80211: introduce and use skb_put_zero()

This pattern was introduced a number of times in mac80211 just now,
and since it's present in a number of other places it makes sense
to add a little helper for it.

This just adds the helper and transforms the mac80211 code, a later
patch will transform other places.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg
2017-05-24 09:07:47 +02:00
parent 71ec289e62
commit e45a79da86
3 changed files with 13 additions and 8 deletions

View File

@@ -1937,6 +1937,15 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
return tmp;
}
static inline unsigned char *skb_put_zero(struct sk_buff *skb, unsigned int len)
{
unsigned char *tmp = skb_put(skb, len);
memset(tmp, 0, len);
return tmp;
}
unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
{