[dpdk-dev] [PATCH] sched: fix useless call
Ferruh Yigit
ferruh.yigit at intel.com
Tue May 10 19:06:08 CEST 2016
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 at 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 at 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
More information about the dev
mailing list