[dpdk-dev] [PATCH] net/iavf: fix null pointer dereference

Zhang, Qi Z qi.z.zhang at intel.com
Thu Jan 14 08:53:18 CET 2021



> -----Original Message-----
> From: Su, Simei <simei.su at intel.com>
> Sent: Thursday, January 14, 2021 1:23 PM
> To: Zhang, Qi Z <qi.z.zhang at intel.com>
> Cc: dev at dpdk.org; Guo, Junfeng <junfeng.guo at intel.com>; Guo, Jia
> <jia.guo at intel.com>; Cao, Yahui <yahui.cao at intel.com>; Su, Simei
> <simei.su at intel.com>
> Subject: [PATCH] net/iavf: fix null pointer dereference
> 
> A pointer has already been dereferenced before checking if it is NULL.
> It doesn't make any sense, so correct to avoid it.
> 
> Fixes: 4f3cfcbc3df3 ("net/iavf: support eCPRI msg type 0 for RSS") Coverity issue:
> 365290
> 
> Signed-off-by: Simei Su <simei.su at intel.com>
> ---
>  drivers/net/iavf/iavf_hash.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index
> ebaac58..9901f4b 100644
> --- a/drivers/net/iavf/iavf_hash.c
> +++ b/drivers/net/iavf/iavf_hash.c
> @@ -597,11 +597,13 @@ iavf_hash_parse_pattern(const struct rte_flow_item
> pattern[], uint64_t *phint,
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_ECPRI:
>  			ecpri = item->spec;
> -			ecpri_common.u32 = rte_be_to_cpu_32(
> -						ecpri->hdr.common.u32);
>  			if (!ecpri)
>  				break;
> -			else if (ecpri_common.type !=
> +
> +			ecpri_common.u32 = rte_be_to_cpu_32(
> +						ecpri->hdr.common.u32);

patchwork warning CHECK:OPEN_ENDED_LINE for above code 
As we have 100 char line limit now, the wrap is not necessary.

Acked-by: Qi Zhang <qi.z.zhang at intel.com>

Applied to dpdk-next-net-intel after capture above fix.

Thanks
Qi


More information about the dev mailing list