cisco-system-traffic-generator/trex-core

Divide by zero exception if number of cores is 0

J-Binieda-ericsson opened this issue · 0 comments

In case of wrong configuration and setting number of cores to 0, m_num_cores is zero and m_mbuf[MBUF_DP_FLOWS]/m_num_cores will result in divide by zero exception.
It would be better to check the number of cores before the calculation.

trex-core/src/main_dpdk.cpp:6918
6916     if ( po->preview.getVMode() > 0){
6917         po->dump(stdout);
6918         CGlobalInfo::m_memory_cfg.Dump(stdout);
 
trex-core/src/main_dpdk.cpp:trex_global.cpp:60
60     fprintf(fd," %-40s  : %lu \n","get_each_core_dp_flows",(ulong)get_each_core_dp_flows());
 
trex-core/src/trex_global.h:814
813     uint32_t get_each_core_dp_flows(){
814         return ( m_mbuf[MBUF_DP_FLOWS]/m_num_cores );