Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Joe Perches
On Fri, 2017-06-16 at 00:17 +0200, Johannes Berg wrote: > On Wed, 2017-06-14 at 14:18 -0700, Joe Perches wrote: > > On Wed, 2017-06-14 at 22:40 +0200, Johannes Berg wrote: > > > On Wed, 2017-06-14 at 13:36 -0700, Joe Perches wrote: > > > > > > > > Given you are adding a lot of these, it might be b

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Joe Perches
On Fri, 2017-06-16 at 00:23 +0200, Johannes Berg wrote: > On Thu, 2017-06-15 at 15:17 -0700, Joe Perches wrote: > > > 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 pe

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Joe Perches
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

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Johannes Berg
On Thu, 2017-06-15 at 15:17 -0700, Joe Perches wrote: > 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*=

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Johannes Berg
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,

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Johannes Berg
On Wed, 2017-06-14 at 14:18 -0700, Joe Perches wrote: > On Wed, 2017-06-14 at 22:40 +0200, Johannes Berg wrote: > > On Wed, 2017-06-14 at 13:36 -0700, Joe Perches wrote: > > > > > > Given you are adding a lot of these, it might be better > > > to add an exported function that duplicates most of >

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Joe Perches
On Thu, 2017-06-15 at 23:28 +0200, Johannes Berg wrote: > On Thu, 2017-06-15 at 17:26 -0400, David Miller wrote: > > > > > *skb_put(skb, 1) = 'x'; > > >   > > > Seems pretty unlikely we have that, and in any case the compiler > > > > would > > > warn (error?) there if skb_put() becomes void. > >

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Johannes Berg
On Thu, 2017-06-15 at 17:26 -0400, David Miller wrote: > > > *skb_put(skb, 1) = 'x'; > >  > > Seems pretty unlikely we have that, and in any case the compiler > would > > warn (error?) there if skb_put() becomes void. > > Actually I am pretty sure I've seen a pattern like that somewhere. :- > )

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread David Miller
From: Johannes Berg Date: Thu, 15 Jun 2017 21:28:32 +0200 > On Thu, 2017-06-15 at 12:18 -0400, David Miller wrote: > >> Although a bit disruptive, it might be nice to convert all of the >> other "char *" related data pointers in skbuff based interfaces. > > I think it'd actually be pretty easy,

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread Johannes Berg
On Thu, 2017-06-15 at 12:18 -0400, David Miller wrote: > Although a bit disruptive, it might be nice to convert all of the > other "char *" related data pointers in skbuff based interfaces. I think it'd actually be pretty easy, since there are very few cases where you need non-void, e.g. *skb_pu

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-15 Thread David Miller
From: Johannes Berg Date: Wed, 14 Jun 2017 22:17:20 +0200 > From: Johannes Berg > > It's nicer to return void, since then there's no need to > cast to any structures. Currently none of the users have > a cast, but a number of future conversions do. > > Signed-off-by: Johannes Berg Applied.

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-14 Thread Joe Perches
On Wed, 2017-06-14 at 22:40 +0200, Johannes Berg wrote: > On Wed, 2017-06-14 at 13:36 -0700, Joe Perches wrote: > > > > Given you are adding a lot of these, it might be better > > to add an exported function that duplicates most of > > skb_put with a memset at the end. > > Yeah, could be done. I'

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-14 Thread Johannes Berg
On Wed, 2017-06-14 at 13:36 -0700, Joe Perches wrote: > > Given you are adding a lot of these, it might be better > to add an exported function that duplicates most of > skb_put with a memset at the end. Yeah, could be done. I'm not sure why you'd want to duplicate it rather than call it though?

Re: [PATCH] skbuff: make skb_put_zero() return void

2017-06-14 Thread Joe Perches
On Wed, 2017-06-14 at 22:17 +0200, Johannes Berg wrote: > From: Johannes Berg > > It's nicer to return void, since then there's no need to > cast to any structures. Currently none of the users have > a cast, but a number of future conversions do. > > Signed-off-by: Johannes Berg > --- > includ

[PATCH] skbuff: make skb_put_zero() return void

2017-06-14 Thread Johannes Berg
From: Johannes Berg It's nicer to return void, since then there's no need to cast to any structures. Currently none of the users have a cast, but a number of future conversions do. Signed-off-by: Johannes Berg --- include/linux/skbuff.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)