From: Yong Wang Date: Fri, 23 Jun 2017 10:57:47 +0000 (-0400) Subject: net/i40e: fix division by 0 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b734923ddc348886bea968ecd4cda5090f2c2934;p=dpdk.git net/i40e: fix division by 0 In function i40e_vsi_config_tc_queue_mapping(), if 'enabled_tcmap' is 0, 'total_tc' might be 0. Then 'total_tc' might be used in a division by 0 in "qpnum_per_tc = i40e_align_floor(vsi->nb_qps / total_tc)". Fix it by changing 'total_tc' from 0 to 1 just as func i40e_vsi_update_queue_mapping() does. Fixes: 4861cde46116 ("i40e: new poll mode driver") Cc: stable@dpdk.org Signed-off-by: Yong Wang Acked-by: Jingjing Wu --- diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 2823d081d7..245d7ac0d5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -4307,6 +4307,8 @@ i40e_vsi_config_tc_queue_mapping(struct i40e_vsi *vsi, for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) if (enabled_tcmap & (1 << i)) total_tc++; + if (total_tc == 0) + total_tc = 1; vsi->enabled_tc = enabled_tcmap; /* Number of queues per enabled TC */