DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] sched: fix useless call
@ 2016-05-10 10:11 Daniel Mrzyglod
  2016-05-10 17:06 ` Ferruh Yigit
  2016-05-10 17:18 ` Dumitrescu, Cristian
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Mrzyglod @ 2016-05-10 10:11 UTC (permalink / raw)
  To: cristian.dumitrescu; +Cc: dev, Daniel Mrzyglod

Fix issue reported by Coverity.
Coverity ID 13338

A function call that seems to have an intended effect has no actual effect
on the logic of the program.

In rte_sched_port_free: A function is called that is only useful for its
return value, and this value is ignored.

Fixes: de3cfa2c9823 ("sched: initial import")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 lib/librte_sched/rte_sched.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 1609ea8..9b962a6 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -749,7 +749,6 @@ rte_sched_port_free(struct rte_sched_port *port)
 			rte_pktmbuf_free(mbufs[i]);
 	}
 
-	rte_bitmap_free(port->bmp);
 	rte_free(port);
 }
 
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH] sched: fix useless call
  2016-05-10 10:11 [dpdk-dev] [PATCH] sched: fix useless call Daniel Mrzyglod
@ 2016-05-10 17:06 ` Ferruh Yigit
  2016-05-10 17:18 ` Dumitrescu, Cristian
  1 sibling, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2016-05-10 17:06 UTC (permalink / raw)
  To: Daniel Mrzyglod, cristian.dumitrescu; +Cc: dev

On 5/10/2016 11:11 AM, Daniel Mrzyglod wrote:
> Fix issue reported by Coverity.
> Coverity ID 13338
> 
> A function call that seems to have an intended effect has no actual effect
> on the logic of the program.
> 
> In rte_sched_port_free: A function is called that is only useful for its
> return value, and this value is ignored.
> 
> Fixes: de3cfa2c9823 ("sched: initial import")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> ---
>  lib/librte_sched/rte_sched.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 1609ea8..9b962a6 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -749,7 +749,6 @@ rte_sched_port_free(struct rte_sched_port *port)
>  			rte_pktmbuf_free(mbufs[i]);
>  	}
>  
> -	rte_bitmap_free(port->bmp);
>  	rte_free(port);
>  }
>  
> 

rte_bitmap_free() just does NULL check on port->bmp.

I thought intention can be to free the "bmp", but this isn't the case:
port->bmp is actually port->bmp_array,
port->bmp_array points somewhere within port->memory,
port->memory (zero sized array) allocated and freed with "port" pointer.

So for this patch:
Acked-by: "Ferruh Yigit <ferruh.yigit@intel.com>"


But as follow up:
rte_bitmap_free() seems only used here, and it does nothing more than
NULL check, with a misleading name, should we remove this function?


Regards,
ferruh

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

* Re: [dpdk-dev] [PATCH] sched: fix useless call
  2016-05-10 10:11 [dpdk-dev] [PATCH] sched: fix useless call Daniel Mrzyglod
  2016-05-10 17:06 ` Ferruh Yigit
@ 2016-05-10 17:18 ` Dumitrescu, Cristian
  2016-05-11  9:46   ` Ferruh Yigit
  1 sibling, 1 reply; 6+ messages in thread
From: Dumitrescu, Cristian @ 2016-05-10 17:18 UTC (permalink / raw)
  To: Mrzyglod, DanielX T; +Cc: dev



> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Tuesday, May 10, 2016 11:11 AM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; Mrzyglod, DanielX T <danielx.t.mrzyglod@intel.com>
> Subject: [PATCH] sched: fix useless call
> 
> Fix issue reported by Coverity.
> Coverity ID 13338
> 
> A function call that seems to have an intended effect has no actual effect
> on the logic of the program.
> 
> In rte_sched_port_free: A function is called that is only useful for its
> return value, and this value is ignored.
> 
> Fixes: de3cfa2c9823 ("sched: initial import")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> ---
>  lib/librte_sched/rte_sched.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 1609ea8..9b962a6 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -749,7 +749,6 @@ rte_sched_port_free(struct rte_sched_port *port)
>  			rte_pktmbuf_free(mbufs[i]);
>  	}
> 
> -	rte_bitmap_free(port->bmp);
>  	rte_free(port);
>  }
> 
> --
> 2.5.5

NAK.

This needs to be flagged out as a false positive to Coverity.

As previously discussed on this email list, the rte_bitmap_free() is an API function that works as a placeholder for any resource freeing that needs to be done for the bitmap. The API function should not be removed and also the call to this function from the rte_sched_port_free() should not be removed either.

Thanks,
Cristian

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

* Re: [dpdk-dev] [PATCH] sched: fix useless call
  2016-05-10 17:18 ` Dumitrescu, Cristian
@ 2016-05-11  9:46   ` Ferruh Yigit
  2016-05-13 10:12     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2016-05-11  9:46 UTC (permalink / raw)
  To: Dumitrescu, Cristian, Mrzyglod, DanielX T; +Cc: dev

On 5/10/2016 6:18 PM, Dumitrescu, Cristian wrote:
> 
> 
>> -----Original Message-----
>> From: Mrzyglod, DanielX T
>> Sent: Tuesday, May 10, 2016 11:11 AM
>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
>> Cc: dev@dpdk.org; Mrzyglod, DanielX T <danielx.t.mrzyglod@intel.com>
>> Subject: [PATCH] sched: fix useless call
>>
>> Fix issue reported by Coverity.
>> Coverity ID 13338
>>
>> A function call that seems to have an intended effect has no actual effect
>> on the logic of the program.
>>
>> In rte_sched_port_free: A function is called that is only useful for its
>> return value, and this value is ignored.
>>
>> Fixes: de3cfa2c9823 ("sched: initial import")
>>
>> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
>> ---
>>  lib/librte_sched/rte_sched.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
>> index 1609ea8..9b962a6 100644
>> --- a/lib/librte_sched/rte_sched.c
>> +++ b/lib/librte_sched/rte_sched.c
>> @@ -749,7 +749,6 @@ rte_sched_port_free(struct rte_sched_port *port)
>>  			rte_pktmbuf_free(mbufs[i]);
>>  	}
>>
>> -	rte_bitmap_free(port->bmp);
>>  	rte_free(port);
>>  }
>>
>> --
>> 2.5.5
> 
> NAK.
> 
> This needs to be flagged out as a false positive to Coverity.
> 
> As previously discussed on this email list, the rte_bitmap_free() is an API function that works as a placeholder for any resource freeing that needs to be done for the bitmap. The API function should not be removed and also the call to this function from the rte_sched_port_free() should not be removed either.
> 

Right now it isn't required and doesn't do anything.
Why not add this function when it is required?

Anyway, if we will keep it, I believe it is good to add a comment that
it is a placeholder, to prevent same confusion in the future.

Regards,
ferruh

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

* Re: [dpdk-dev] [PATCH] sched: fix useless call
  2016-05-11  9:46   ` Ferruh Yigit
@ 2016-05-13 10:12     ` Thomas Monjalon
  2016-05-13 11:04       ` Dumitrescu, Cristian
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2016-05-13 10:12 UTC (permalink / raw)
  To: Dumitrescu, Cristian; +Cc: dev, Ferruh Yigit, Mrzyglod, DanielX T

2016-05-11 10:46, Ferruh Yigit:
> On 5/10/2016 6:18 PM, Dumitrescu, Cristian wrote:
> > As previously discussed on this email list, the rte_bitmap_free() is an API function that works as a placeholder for any resource freeing that needs to be done for the bitmap. The API function should not be removed and also the call to this function from the rte_sched_port_free() should not be removed either.
> > 
> 
> Right now it isn't required and doesn't do anything.
> Why not add this function when it is required?

I don't understand why we keep a function which does nothing.

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

* Re: [dpdk-dev] [PATCH] sched: fix useless call
  2016-05-13 10:12     ` Thomas Monjalon
@ 2016-05-13 11:04       ` Dumitrescu, Cristian
  0 siblings, 0 replies; 6+ messages in thread
From: Dumitrescu, Cristian @ 2016-05-13 11:04 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Yigit, Ferruh, Mrzyglod, DanielX T



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, May 13, 2016 11:12 AM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Mrzyglod, DanielX
> T <danielx.t.mrzyglod@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] sched: fix useless call
> 
> 2016-05-11 10:46, Ferruh Yigit:
> > On 5/10/2016 6:18 PM, Dumitrescu, Cristian wrote:
> > > As previously discussed on this email list, the rte_bitmap_free() is an API
> function that works as a placeholder for any resource freeing that needs to
> be done for the bitmap. The API function should not be removed and also
> the call to this function from the rte_sched_port_free() should not be
> removed either.
> > >
> >
> > Right now it isn't required and doesn't do anything.
> > Why not add this function when it is required?
> 
> I don't understand why we keep a function which does nothing.

Every data type/class/object should have a constructor/create and destructor/free function. This is standard programming practice, right?

This API function is the free function for the bitmap object. Right now there are no internally allocated resources to be freed, but as code evolves, some other internal memory could be allocated by the bitmap, which needs to be freed in the bitmap free function.

This function should be kept in order to have a stable API. We should not go back and forth with adding / removing API functions as code evolves. It does not make any sense to go through the ABI change process to remove this API function now just to come back later on and go again through ABI change to add back this API function later.

I think each DPDK object should have its create and free functions clearly identified in the API.

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

end of thread, other threads:[~2016-05-13 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 10:11 [dpdk-dev] [PATCH] sched: fix useless call Daniel Mrzyglod
2016-05-10 17:06 ` Ferruh Yigit
2016-05-10 17:18 ` Dumitrescu, Cristian
2016-05-11  9:46   ` Ferruh Yigit
2016-05-13 10:12     ` Thomas Monjalon
2016-05-13 11:04       ` Dumitrescu, Cristian

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