[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1497565276.2518.16.camel@sipsolutions.net>
Date: Fri, 16 Jun 2017 00:21:16 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Joe Perches <joe@...ches.com>, David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] skbuff: make skb_put_zero() return void
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 :-)
johannes
Powered by blists - more mailing lists