]> git.droids-corp.org - dpdk.git/commitdiff
examples/vhost: fix crash when no VMDq
authorYuan Wang <yuanx.wang@intel.com>
Wed, 18 May 2022 13:36:33 +0000 (21:36 +0800)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Wed, 1 Jun 2022 09:50:10 +0000 (11:50 +0200)
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 <yuanx.wang@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
examples/vhost/main.c

index 5bc34b0c52502fd9239c7ac1653d4c9b2c18f5c9..e7fee5aa1bc25b7082d273544aa27e7f16815acf 100644 (file)
@@ -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;