From e45a79da863c199d7c47b1ee6d33cee23c89eac1 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 24 May 2017 09:07:47 +0200 Subject: 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 Signed-off-by: Johannes Berg --- include/linux/skbuff.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/linux/skbuff.h') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bfc7892f6c33..d92056b2da44 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -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) { -- cgit