[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170614084434.3342671d@xeon-e3>
Date: Wed, 14 Jun 2017 08:44:34 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: yuan linyu <cugyly@....com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
yuan linyu <Linyu.Yuan@...atel-sbell.com.cn>
Subject: Re: [PATCH net-next 01/11] ipv6: skb_put_zero() used to optimize
code
On Wed, 14 Jun 2017 22:37:06 +0800
yuan linyu <cugyly@....com> wrote:
> From: yuan linyu <Linyu.Yuan@...atel-sbell.com.cn>
>
> Signed-off-by: yuan linyu <Linyu.Yuan@...atel-sbell.com.cn>
> ---
> net/ipv6/mcast.c | 3 +--
> net/ipv6/ndisc.c | 13 ++-----------
> 2 files changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index 07403fa..b186c67 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -2008,8 +2008,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
>
> memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
>
> - hdr = (struct mld_msg *) skb_put(skb, sizeof(struct mld_msg));
> - memset(hdr, 0, sizeof(struct mld_msg));
> + hdr = (struct mld_msg *) skb_put_zero(skb, sizeof(struct mld_msg));
Why does skb_put_zero return char * instead of void *?
If returned void * it would save having to add lots of casts.
One could even go farther by making skb_put_zero a macro and
use typeof().
Powered by blists - more mailing lists