From 6f3d83c7f207d435d960ad881f127e9971a81069 Mon Sep 17 00:00:00 2001 From: Yuan Wang Date: Wed, 18 May 2022 21:36:33 +0800 Subject: [PATCH] examples/vhost: fix crash 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@dpdk.org Signed-off-by: Yuan Wang Reviewed-by: Chenbo Xia --- examples/vhost/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 5bc34b0c52..e7fee5aa1b 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -431,6 +431,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.39.5