[PATCH v2] examples/vhost: fix floating point exception when no VMDq

Xia, Chenbo chenbo.xia at intel.com
Mon May 30 04:52:32 CEST 2022


> -----Original Message-----
> From: Wang, YuanX <yuanx.wang at intel.com>
> Sent: Wednesday, May 18, 2022 9:37 PM
> To: maxime.coquelin at redhat.com; Xia, Chenbo <chenbo.xia at intel.com>
> Cc: dev at dpdk.org; Hu, Jiayu <jiayu.hu at intel.com>; He, Xingguang
> <xingguang.he at intel.com>; Wang, YuanX <yuanx.wang at intel.com>;
> stable at dpdk.org
> Subject: [PATCH v2] examples/vhost: fix floating point exception when no
> VMDq
> 
> If the VMDQ limits is 0, a divide-by-zero error occurs.
> This patch replaces throwing a floating point exception with
> a normal error message.
> 
> Fixes: d19533e86f ("examples/vhost: copy old vhost example")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Yuan Wang <yuanx.wang at intel.com>
> ---
>  examples/vhost/main.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index c4d46de1c5..48d9f3802f 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -400,6 +400,10 @@ port_init(uint16_t port)
> 
>  		return retval;
>  	}
> +	if (dev_info.max_vmdq_pools == 0) {
> +		RTE_LOG(ERR, VHOST_PORT, "Failed to get VMDQ info.\n");
> +		return -1;
> +	}
> 
>  	rxconf = &dev_info.default_rxconf;
>  	txconf = &dev_info.default_txconf;
> --
> 2.25.1

Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>


More information about the stable mailing list