From: Jasvinder Singh Date: Thu, 19 Oct 2017 09:38:18 +0000 (+0100) Subject: app/testpmd: fix integer overflow X-Git-Tag: spdx-start~1152 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=da101321e746b5c538f3b4d990d9a9c06c8a4d44;p=dpdk.git app/testpmd: fix integer overflow Fixed integer overflow by casting link_params.link_speed to uint64_t type. Coverity issue: 195016 Fixes: 5b590fbe09b6 ("app/testpmd: add traffic management forwarding mode") Signed-off-by: Jasvinder Singh Reviewed-by: Ferruh Yigit --- diff --git a/app/test-pmd/tm.c b/app/test-pmd/tm.c index da1adda98a..dd837cb8c3 100644 --- a/app/test-pmd/tm.c +++ b/app/test-pmd/tm.c @@ -335,7 +335,7 @@ set_tm_hiearchy_nodes_shaper_rate(portid_t port_id, struct tm_hierarchy *h) memset(&link_params, 0, sizeof(link_params)); rte_eth_link_get(port_id, &link_params); - tm_port_rate = link_params.link_speed * BYTES_IN_MBPS; + tm_port_rate = (uint64_t)link_params.link_speed * BYTES_IN_MBPS; if (tm_port_rate > UINT32_MAX) tm_port_rate = UINT32_MAX;