All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: yuan linyu <cugyly@163.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Subject: Re: [PATCH net-next 01/11] ipv6: skb_put_zero() used to optimize code
Date: Wed, 14 Jun 2017 08:44:34 -0700	[thread overview]
Message-ID: <20170614084434.3342671d@xeon-e3> (raw)
In-Reply-To: <1497451026-3923-1-git-send-email-cugyly@163.com>

On Wed, 14 Jun 2017 22:37:06 +0800
yuan linyu <cugyly@163.com> wrote:

> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> 
> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-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().

  reply	other threads:[~2017-06-14 15:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 14:37 [PATCH net-next 01/11] ipv6: skb_put_zero() used to optimize code yuan linyu
2017-06-14 15:44 ` Stephen Hemminger [this message]
2017-06-14 19:01   ` Johannes Berg
2017-06-14 19:14     ` Stephen Hemminger
2017-06-14 19:51       ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170614084434.3342671d@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=Linyu.Yuan@alcatel-sbell.com.cn \
    --cc=cugyly@163.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.