netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fib_trie: Fix potential null pointer dereference
@ 2015-06-06 11:35 Firo Yang
  2015-06-06 12:05 ` Eric Dumazet
  2015-06-06 13:39 ` walter harms
  0 siblings, 2 replies; 12+ messages in thread
From: Firo Yang @ 2015-06-06 11:35 UTC (permalink / raw)
  To: davem; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, kernel-janitors,
	Firo Yang

A smatch warning.
When kmem_cache_alloc() failed to alloc memory, a null pointer
will be returned. Redeference null pointer will generate
an unnecessary oops. So, use it after check.

Signed-off-by: Firo Yang <firogm@gmail.com>
---
 net/ipv4/fib_trie.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 01bce15..34094c7 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
 static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
 {
 	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
-	struct key_vector *l = kv->kv;
+	struct key_vector *l;
 
 	if (!kv)
 		return NULL;
 
 	/* initialize key vector */
+	l = kv->kv;
 	l->key = key;
 	l->pos = 0;
 	l->bits = 0;
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-06 11:35 [PATCH] fib_trie: Fix potential null pointer dereference Firo Yang
@ 2015-06-06 12:05 ` Eric Dumazet
  2015-06-07  3:20   ` Alexander Duyck
                     ` (2 more replies)
  2015-06-06 13:39 ` walter harms
  1 sibling, 3 replies; 12+ messages in thread
From: Eric Dumazet @ 2015-06-06 12:05 UTC (permalink / raw)
  To: Firo Yang
  Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev, kernel-janitors

On Sat, 2015-06-06 at 19:35 +0800, Firo Yang wrote:
> A smatch warning.
> When kmem_cache_alloc() failed to alloc memory, a null pointer
> will be returned. Redeference null pointer will generate


Dereferencing a null pointer will crash.

> an unnecessary oops. So, use it after check.
> 
> Signed-off-by: Firo Yang <firogm@gmail.com>
> ---
>  net/ipv4/fib_trie.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index 01bce15..34094c7 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
>  static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
>  {
>  	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
> -	struct key_vector *l = kv->kv;
> +	struct key_vector *l;
>  
>  	if (!kv)
>  		return NULL;
>  
>  	/* initialize key vector */
> +	l = kv->kv;
>  	l->key = key;
>  	l->pos = 0;
>  	l->bits = 0;

Fixes: dc35dbeda3e0 ("fib_trie: Add tnode struct as a container for fields not needed in key_vector")
Acked-by: Eric Dumazet <edumazet@google.com>

Thanks.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-06 11:35 [PATCH] fib_trie: Fix potential null pointer dereference Firo Yang
  2015-06-06 12:05 ` Eric Dumazet
@ 2015-06-06 13:39 ` walter harms
  2015-06-07  4:52   ` Firo Yang
  1 sibling, 1 reply; 12+ messages in thread
From: walter harms @ 2015-06-06 13:39 UTC (permalink / raw)
  To: Firo Yang
  Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev, kernel-janitors



Am 06.06.2015 13:35, schrieb Firo Yang:
> A smatch warning.
> When kmem_cache_alloc() failed to alloc memory, a null pointer
> will be returned. Redeference null pointer will generate
> an unnecessary oops. So, use it after check.
> 
> Signed-off-by: Firo Yang <firogm@gmail.com>
> ---
>  net/ipv4/fib_trie.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index 01bce15..34094c7 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
>  static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
>  {
>  	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
> -	struct key_vector *l = kv->kv;
> +	struct key_vector *l;

It is a good custom to have action and check close together, so this may be more
obvious for future readers:
	struct tnode *kv;
	struct key_vector *l;

        kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
  	if (!kv)
  		return NULL;


re,
 wh

>  	/* initialize key vector */
> +	l = kv->kv;
>  	l->key = key;
>  	l->pos = 0;
>  	l->bits = 0;

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-06 12:05 ` Eric Dumazet
@ 2015-06-07  3:20   ` Alexander Duyck
       [not found]   ` <5573B7A2.4010607@gmail.com>
  2015-06-07  6:01   ` Firo Yang
  2 siblings, 0 replies; 12+ messages in thread
From: Alexander Duyck @ 2015-06-07  3:20 UTC (permalink / raw)
  To: Eric Dumazet, Firo Yang
  Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev, kernel-janitors

On 06/06/2015 05:05 AM, Eric Dumazet wrote:
> On Sat, 2015-06-06 at 19:35 +0800, Firo Yang wrote:
>> A smatch warning.
>> When kmem_cache_alloc() failed to alloc memory, a null pointer
>> will be returned. Redeference null pointer will generate
>
>
> Dereferencing a null pointer will crash.
>
>> an unnecessary oops. So, use it after check.
>>
>> Signed-off-by: Firo Yang <firogm@gmail.com>
>> ---
>>   net/ipv4/fib_trie.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
>> index 01bce15..34094c7 100644
>> --- a/net/ipv4/fib_trie.c
>> +++ b/net/ipv4/fib_trie.c
>> @@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
>>   static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
>>   {
>>   	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
>> -	struct key_vector *l = kv->kv;
>> +	struct key_vector *l;
>>
>>   	if (!kv)
>>   		return NULL;
>>
>>   	/* initialize key vector */
>> +	l = kv->kv;
>>   	l->key = key;
>>   	l->pos = 0;
>>   	l->bits = 0;
>
> Fixes: dc35dbeda3e0 ("fib_trie: Add tnode struct as a container for fields not needed in key_vector")
> Acked-by: Eric Dumazet <edumazet@google.com>
>
> Thanks.

kv->kv isn't a dereference.  kv is an array contained within the tnode. 
  Below is the layout of struct tnode:


struct tnode {
	struct rcu_head rcu;
	t_key empty_children;		/* KEYLENGTH bits needed */
	t_key full_children;		/* KEYLENGTH bits needed */
	struct key_vector __rcu *parent;
	struct key_vector kv[1];
#define tn_bits kv[0].bits
};


As such kv->kv doesn't actually dereference anything, it is simply a 
means for getting the offset to the array from the pointer kv.  It 
should be equivalent to &kv->kv[0] which last I knew was how the 
offsetof macro basically worked and it uses a NULL pointer.  The first 
actual derference occurs at "l->key = key" which should be safe since 
writing to a memory location has side effects so the compiler cannot 
reorder the writes before the !kv check.

The patch itself is fine.  However what it is fixing is the smatch false 
positive, not a null pointer deference.  As such you may need to update 
the comments to reflect that.

- Alex




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
       [not found]   ` <5573B7A2.4010607@gmail.com>
@ 2015-06-07  4:46     ` Firo Yang
  0 siblings, 0 replies; 12+ messages in thread
From: Firo Yang @ 2015-06-07  4:46 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Eric Dumazet, davem, kuznet, jmorris, yoshfuji, kaber, netdev,
	kernel-janitors

On Sat, Jun 06, 2015 at 08:16:50PM -0700, Alexander Duyck wrote:
>On 06/06/2015 05:05 AM, Eric Dumazet wrote:
>>On Sat, 2015-06-06 at 19:35 +0800, Firo Yang wrote:
>>>A smatch warning.
>>>When kmem_cache_alloc() failed to alloc memory, a null pointer
>>>will be returned. Redeference null pointer will generate
>>
>>Dereferencing a null pointer will crash.
>>
>>>an unnecessary oops. So, use it after check.
>>>
>>>Signed-off-by: Firo Yang <firogm@gmail.com>
>>>---
>>>  net/ipv4/fib_trie.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>>diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
>>>index 01bce15..34094c7 100644
>>>--- a/net/ipv4/fib_trie.c
>>>+++ b/net/ipv4/fib_trie.c
>>>@@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
>>>  static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
>>>  {
>>>  	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
>>>-	struct key_vector *l = kv->kv;
>>>+	struct key_vector *l;
>>>  	if (!kv)
>>>  		return NULL;
>>>  	/* initialize key vector */
>>>+	l = kv->kv;
>>>  	l->key = key;
>>>  	l->pos = 0;
>>>  	l->bits = 0;
>>Fixes: dc35dbeda3e0 ("fib_trie: Add tnode struct as a container for fields not needed in key_vector")
>>Acked-by: Eric Dumazet <edumazet@google.com>
>>
>>Thanks.
>
>kv->kv isn't a dereference.  kv is an array contained within the tnode.
>Below is the layout of struct tnode:
>
>|
>struct  tnode{
>	struct  rcu_head rcu;
>	t_key empty_children;		/* KEYLENGTH bits needed */
>	t_key full_children;		/* KEYLENGTH bits needed */
>	struct  key_vector __rcu*parent;
>	struct  key_vector kv[1];
>#define tn_bits kv[0].bits
>};|
>
>
>As such kv->kv doesn't actually dereference anything, it is simply a means
>for getting the offset to the array from the pointer kv.  It should be
>equivalent to &kv->kv[0] which last I knew was how the offsetof macro
>basically worked and it uses a NULL pointer.  The first actual derference
>occurs at "l->key = key" which should be safe since writing to a memory
>location has side effects so the compiler cannot reorder the writes before
>the !kv check.
>
>The patch itself is fine.  However what it is fixing is the smatch false
>positive, not a null pointer deference.  As such you may need to update the
>comments to reflect that.

Thanks Alex for firguring out my false cognition!
I will update the patch with new comments.

Firo

>
>- Alex
>
>

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-06 13:39 ` walter harms
@ 2015-06-07  4:52   ` Firo Yang
  0 siblings, 0 replies; 12+ messages in thread
From: Firo Yang @ 2015-06-07  4:52 UTC (permalink / raw)
  To: walter harms
  Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev, kernel-janitors

On Sat, Jun 06, 2015 at 03:39:38PM +0200, walter harms wrote:
>
>
>Am 06.06.2015 13:35, schrieb Firo Yang:
>> A smatch warning.
>> When kmem_cache_alloc() failed to alloc memory, a null pointer
>> will be returned. Redeference null pointer will generate
>> an unnecessary oops. So, use it after check.
>> 
>> Signed-off-by: Firo Yang <firogm@gmail.com>
>> ---
>>  net/ipv4/fib_trie.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
>> index 01bce15..34094c7 100644
>> --- a/net/ipv4/fib_trie.c
>> +++ b/net/ipv4/fib_trie.c
>> @@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
>>  static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
>>  {
>>  	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
>> -	struct key_vector *l = kv->kv;
>> +	struct key_vector *l;
>
>It is a good custom to have action and check close together, so this may be more
>obvious for future readers:
>	struct tnode *kv;
>	struct key_vector *l;
>
>        kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
>  	if (!kv)
>  		return NULL;
>
>
>re,
> wh
Thanks walter harms, I will update the patch like this.
>
>>  	/* initialize key vector */
>> +	l = kv->kv;
>>  	l->key = key;
>>  	l->pos = 0;
>>  	l->bits = 0;

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-06 12:05 ` Eric Dumazet
  2015-06-07  3:20   ` Alexander Duyck
       [not found]   ` <5573B7A2.4010607@gmail.com>
@ 2015-06-07  6:01   ` Firo Yang
  2015-06-07  6:36     ` Julia Lawall
  2 siblings, 1 reply; 12+ messages in thread
From: Firo Yang @ 2015-06-07  6:01 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev, kernel-janitors

On Sat, Jun 06, 2015 at 05:05:04AM -0700, Eric Dumazet wrote:
>On Sat, 2015-06-06 at 19:35 +0800, Firo Yang wrote:
>> A smatch warning.
>> When kmem_cache_alloc() failed to alloc memory, a null pointer
>> will be returned. Redeference null pointer will generate
>
>
>Dereferencing a null pointer will crash.
>
>> an unnecessary oops. So, use it after check.
>> 
>> Signed-off-by: Firo Yang <firogm@gmail.com>
>> ---
>>  net/ipv4/fib_trie.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
>> index 01bce15..34094c7 100644
>> --- a/net/ipv4/fib_trie.c
>> +++ b/net/ipv4/fib_trie.c
>> @@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
>>  static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
>>  {
>>  	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
>> -	struct key_vector *l = kv->kv;
>> +	struct key_vector *l;
>>  
>>  	if (!kv)
>>  		return NULL;
>>  
>>  	/* initialize key vector */
>> +	l = kv->kv;
>>  	l->key = key;
>>  	l->pos = 0;
>>  	l->bits = 0;
>
>Fixes: dc35dbeda3e0 ("fib_trie: Add tnode struct as a container for fields not needed in key_vector")
>Acked-by: Eric Dumazet <edumazet@google.com>
>
>Thanks.

Hi Eric,
Please discard this useless patch figured out by Alexander Duyck. 
I will send a patch to Smatch for eliminating the negative warning.

>
>

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-07  6:01   ` Firo Yang
@ 2015-06-07  6:36     ` Julia Lawall
  2015-06-07 13:19       ` Firo Yang
  0 siblings, 1 reply; 12+ messages in thread
From: Julia Lawall @ 2015-06-07  6:36 UTC (permalink / raw)
  To: Firo Yang
  Cc: Eric Dumazet, davem, kuznet, jmorris, yoshfuji, kaber, netdev,
	kernel-janitors



On Sun, 7 Jun 2015, Firo Yang wrote:

> On Sat, Jun 06, 2015 at 05:05:04AM -0700, Eric Dumazet wrote:
> >On Sat, 2015-06-06 at 19:35 +0800, Firo Yang wrote:
> >> A smatch warning.
> >> When kmem_cache_alloc() failed to alloc memory, a null pointer
> >> will be returned. Redeference null pointer will generate
> >
> >
> >Dereferencing a null pointer will crash.
> >
> >> an unnecessary oops. So, use it after check.
> >> 
> >> Signed-off-by: Firo Yang <firogm@gmail.com>
> >> ---
> >>  net/ipv4/fib_trie.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> >> index 01bce15..34094c7 100644
> >> --- a/net/ipv4/fib_trie.c
> >> +++ b/net/ipv4/fib_trie.c
> >> @@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
> >>  static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
> >>  {
> >>  	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
> >> -	struct key_vector *l = kv->kv;
> >> +	struct key_vector *l;
> >>  
> >>  	if (!kv)
> >>  		return NULL;
> >>  
> >>  	/* initialize key vector */
> >> +	l = kv->kv;
> >>  	l->key = key;
> >>  	l->pos = 0;
> >>  	l->bits = 0;
> >
> >Fixes: dc35dbeda3e0 ("fib_trie: Add tnode struct as a container for fields not needed in key_vector")
> >Acked-by: Eric Dumazet <edumazet@google.com>
> >
> >Thanks.
> 
> Hi Eric,
> Please discard this useless patch figured out by Alexander Duyck. 
> I will send a patch to Smatch for eliminating the negative warning.

I think that many people would make the same mistake when looking at the 
code.  The change doesn't seem to hurt anything?

julia

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-07  6:36     ` Julia Lawall
@ 2015-06-07 13:19       ` Firo Yang
  2015-06-07 13:23         ` Julia Lawall
  0 siblings, 1 reply; 12+ messages in thread
From: Firo Yang @ 2015-06-07 13:19 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Eric Dumazet, davem, kuznet, jmorris, yoshfuji, kaber, netdev,
	kernel-janitors

On Sun, Jun 07, 2015 at 08:36:45AM +0200, Julia Lawall wrote:
>
>
>On Sun, 7 Jun 2015, Firo Yang wrote:
>
>> On Sat, Jun 06, 2015 at 05:05:04AM -0700, Eric Dumazet wrote:
>> >On Sat, 2015-06-06 at 19:35 +0800, Firo Yang wrote:
>> >> A smatch warning.
>> >> When kmem_cache_alloc() failed to alloc memory, a null pointer
>> >> will be returned. Redeference null pointer will generate
>> >
>> >
>> >Dereferencing a null pointer will crash.
>> >
>> >> an unnecessary oops. So, use it after check.
>> >> 
>> >> Signed-off-by: Firo Yang <firogm@gmail.com>
>> >> ---
>> >>  net/ipv4/fib_trie.c | 3 ++-
>> >>  1 file changed, 2 insertions(+), 1 deletion(-)
>> >> 
>> >> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
>> >> index 01bce15..34094c7 100644
>> >> --- a/net/ipv4/fib_trie.c
>> >> +++ b/net/ipv4/fib_trie.c
>> >> @@ -326,12 +326,13 @@ static inline void empty_child_dec(struct key_vector *n)
>> >>  static struct key_vector *leaf_new(t_key key, struct fib_alias *fa)
>> >>  {
>> >>  	struct tnode *kv = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL);
>> >> -	struct key_vector *l = kv->kv;
>> >> +	struct key_vector *l;
>> >>  
>> >>  	if (!kv)
>> >>  		return NULL;
>> >>  
>> >>  	/* initialize key vector */
>> >> +	l = kv->kv;
>> >>  	l->key = key;
>> >>  	l->pos = 0;
>> >>  	l->bits = 0;
>> >
>> >Fixes: dc35dbeda3e0 ("fib_trie: Add tnode struct as a container for fields not needed in key_vector")
>> >Acked-by: Eric Dumazet <edumazet@google.com>
>> >
>> >Thanks.
>> 
>> Hi Eric,
>> Please discard this useless patch figured out by Alexander Duyck. 
>> I will send a patch to Smatch for eliminating the negative warning.
>
>I think that many people would make the same mistake when looking at the 
>code.  The change doesn't seem to hurt anything?
Actually, yes. But it does imporve nothing but coding style.
I think Alexander's code style make function more compact is also a
good code style. So, just keep it original.

Firo
>
>julia

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-07 13:19       ` Firo Yang
@ 2015-06-07 13:23         ` Julia Lawall
  2015-06-07 13:42           ` Firo Yang
  2015-06-07 16:36           ` Alexander Duyck
  0 siblings, 2 replies; 12+ messages in thread
From: Julia Lawall @ 2015-06-07 13:23 UTC (permalink / raw)
  To: Firo Yang
  Cc: Julia Lawall, Eric Dumazet, davem, kuznet, jmorris, yoshfuji,
	kaber, netdev, kernel-janitors

> >I think that many people would make the same mistake when looking at the
> >code.  The change doesn't seem to hurt anything?
> Actually, yes. But it does imporve nothing but coding style.
> I think Alexander's code style make function more compact is also a
> good code style. So, just keep it original.

Still it makes noise when other people look at the code and find that it
looks odd.  Removing the false positive in smatch won't completely help,
because people could look at the code for other reasons.

But, as you like.

julia

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-07 13:23         ` Julia Lawall
@ 2015-06-07 13:42           ` Firo Yang
  2015-06-07 16:36           ` Alexander Duyck
  1 sibling, 0 replies; 12+ messages in thread
From: Firo Yang @ 2015-06-07 13:42 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Eric Dumazet, davem, kuznet, jmorris, yoshfuji, kaber, netdev,
	kernel-janitors

On Sun, Jun 07, 2015 at 03:23:57PM +0200, Julia Lawall wrote:
>> >I think that many people would make the same mistake when looking at the
>> >code.  The change doesn't seem to hurt anything?
>> Actually, yes. But it does imporve nothing but coding style.
>> I think Alexander's code style make function more compact is also a
>> good code style. So, just keep it original.
>
>Still it makes noise when other people look at the code and find that it
>looks odd.  Removing the false positive in smatch won't completely help,
>because people could look at the code for other reasons.

You said it! I will do the improvement.

Firo

>
>But, as you like.
>
>julia

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] fib_trie: Fix potential null pointer dereference
  2015-06-07 13:23         ` Julia Lawall
  2015-06-07 13:42           ` Firo Yang
@ 2015-06-07 16:36           ` Alexander Duyck
  1 sibling, 0 replies; 12+ messages in thread
From: Alexander Duyck @ 2015-06-07 16:36 UTC (permalink / raw)
  To: Julia Lawall, Firo Yang
  Cc: Eric Dumazet, davem, kuznet, jmorris, yoshfuji, kaber, netdev,
	kernel-janitors, wharms

On 06/07/2015 06:23 AM, Julia Lawall wrote:
>>> I think that many people would make the same mistake when looking at the
>>> code.  The change doesn't seem to hurt anything?
>> Actually, yes. But it does imporve nothing but coding style.
>> I think Alexander's code style make function more compact is also a
>> good code style. So, just keep it original.
>
> Still it makes noise when other people look at the code and find that it
> looks odd.  Removing the false positive in smatch won't completely help,
> because people could look at the code for other reasons.

I agree.  The patch is good.  My only comment was about the patch 
description.  You are fixing a coding style issue reported by smatch, 
not a NULL pointer dereference.  This is a code clean-up rather than a 
fix, but still the patch is just as useful.

While you are at it you could probably also incorporate the suggestion 
from Walter as that helps to improve the readability further.

- Alex

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-07 16:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-06 11:35 [PATCH] fib_trie: Fix potential null pointer dereference Firo Yang
2015-06-06 12:05 ` Eric Dumazet
2015-06-07  3:20   ` Alexander Duyck
     [not found]   ` <5573B7A2.4010607@gmail.com>
2015-06-07  4:46     ` Firo Yang
2015-06-07  6:01   ` Firo Yang
2015-06-07  6:36     ` Julia Lawall
2015-06-07 13:19       ` Firo Yang
2015-06-07 13:23         ` Julia Lawall
2015-06-07 13:42           ` Firo Yang
2015-06-07 16:36           ` Alexander Duyck
2015-06-06 13:39 ` walter harms
2015-06-07  4:52   ` Firo Yang

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).