netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Stephen Hemminger <stephen@networkplumber.org>,
	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 21:01:32 +0200	[thread overview]
Message-ID: <1497466892.9377.5.camel@sipsolutions.net> (raw)
In-Reply-To: <20170614084434.3342671d@xeon-e3> (sfid-20170614_174449_128728_DD5F5738)

On Wed, 2017-06-14 at 08:44 -0700, Stephen Hemminger wrote:
> 
> >  	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().

I just copied it from skb_put() - you could ask the same there? :)

No objection to changing it though.

johannes

  reply	other threads:[~2017-06-14 19:01 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
2017-06-14 19:01   ` Johannes Berg [this message]
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=1497466892.9377.5.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=Linyu.Yuan@alcatel-sbell.com.cn \
    --cc=cugyly@163.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).