public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches•com>
To: Johannes Berg <johannes@sipsolutions•net>,
	David Miller <davem@davemloft•net>
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH] skbuff: make skb_put_zero() return void
Date: Thu, 15 Jun 2017 15:30:58 -0700	[thread overview]
Message-ID: <1497565858.14396.23.camel@perches.com> (raw)
In-Reply-To: <1497565276.2518.16.camel@sipsolutions.net>

On Fri, 2017-06-16 at 00:21 +0200, Johannes Berg wrote:
> On Thu, 2017-06-15 at 15:17 -0700, Joe Perches wrote:
> 
> > I suggest changing those to skb_put_char(skb, char)
> 
> That might be something to think of, but you can't really know for sure
> that they're not using len > 1 and don't yet care about the other bytes
> or something. That'd probably be another bug, but ... dunno
> 
> And anyway, I think
> 
> *(u8 *)skb_put(skb, 1) = c;
> 
> isn't really that bad. Obviously that could be converted further to
> skb_put_char(), using a simple spatch:
> 
> @@
> expression SKB, C;
> @@
> - *(u8 *)skb_put(SKB, 1) = C;
> + skb_put_char(SKB, C);
> 
> 
> > Here's a script that does the conversion.
> > 
> > $ /usr/bin/git grep -P --name-only
> > "\*\s*skb_put\s*\(\s*([\w\.\[\]\>\-]+)\s*,\s*1\s*\)\s*=\s*([^;]+);" |
> > \
> >   xargs perl -p -i -e 's/\*\s*skb_put\s*\(\s*([\w\.\[\]\>\-
> > ]+)\s*,\s*1\s*\)\s*=\s*([^;]+);/skb_put_char(\1, \2);/'
> 
> Uh, I think you're using the wrong tool for the job :-)

I'm familiar with both.

It depends on how much you want to wait.

The thing I wrote finished in about 2 seconds
on my little laptop.

cheers, Joe

  reply	other threads:[~2017-06-15 22:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 20:17 [PATCH] skbuff: make skb_put_zero() return void Johannes Berg
2017-06-14 20:36 ` Joe Perches
2017-06-14 20:40   ` Johannes Berg
2017-06-14 21:18     ` Joe Perches
2017-06-15 22:17       ` Johannes Berg
2017-06-15 22:55         ` Joe Perches
2017-06-15 16:18 ` David Miller
2017-06-15 19:28   ` Johannes Berg
2017-06-15 21:26     ` David Miller
2017-06-15 21:28       ` Johannes Berg
2017-06-15 22:17         ` Joe Perches
2017-06-15 22:21           ` Johannes Berg
2017-06-15 22:30             ` Joe Perches [this message]
2017-06-15 22:23           ` Johannes Berg
2017-06-15 22:38             ` Joe Perches

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=1497565858.14396.23.camel@perches.com \
    --to=joe@perches$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=johannes@sipsolutions$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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