[dpdk-stable] [dpdk-dev] [PATCH] event/dpaa2: fix dereference before null check

Nipun Gupta nipun.gupta at nxp.com
Sun Oct 4 12:53:32 CEST 2020


Acked-by: Nipun Gupta <nipun.gupta at nxp.com>

> -----Original Message-----
> From: wangyunjian <wangyunjian at huawei.com>
> Sent: Wednesday, August 26, 2020 6:38 PM
> To: dev at dpdk.org; Hemant Agrawal <hemant.agrawal at nxp.com>; Nipun Gupta
> <nipun.gupta at nxp.com>
> Cc: jerry.lilijun at huawei.com; xudingke at huawei.com; Yunjian Wang
> <wangyunjian at huawei.com>; stable at dpdk.org
> Subject: [dpdk-dev] [PATCH] event/dpaa2: fix dereference before null check
> 
> From: Yunjian Wang <wangyunjian at huawei.com>
> 
> Coverity flags that 'portal' variable is used before
> it's checked for NULL. This patch fixes this issue.
> 
> Coverity issue: 323516
> Fixes: 4ab57b042e7c ("event/dpaa2: affine portal at runtime during I/O")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
> ---
>  drivers/event/dpaa2/dpaa2_eventdev.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 3ae4441ee..f7383ca73 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -569,14 +569,14 @@ dpaa2_eventdev_port_release(void *port)
> 
>  	EVENTDEV_INIT_FUNC_TRACE();
> 
> +	if (portal == NULL)
> +		return;
> +
>  	/* TODO: Cleanup is required when ports are in linked state. */
>  	if (portal->is_port_linked)
>  		DPAA2_EVENTDEV_WARN("Event port must be unlinked before
> release");
> 
> -	if (portal)
> -		rte_free(portal);
> -
> -	portal = NULL;
> +	rte_free(portal);
>  }
> 
>  static int
> --
> 2.23.0
> 



More information about the stable mailing list