Skip to content

Commit

Permalink
examples/vhost: fix crash when no VMDq
Browse files Browse the repository at this point in the history
[ upstream commit 6f3d83c ]

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: d19533e ("examples/vhost: copy old vhost example")

Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  • Loading branch information
yuanx-wang authored and kevintraynor committed Jun 8, 2022
1 parent b306212 commit d512315
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/vhost/main.c
Expand Up @@ -264,6 +264,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;
Expand Down

0 comments on commit d512315

Please sign in to comment.