DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix integer overflow
@ 2017-10-19  9:38 Jasvinder Singh
  2017-10-23 18:53 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Jasvinder Singh @ 2017-10-19  9:38 UTC (permalink / raw)
  To: dev

Fixed integer overflow by casting link_params.link_speed to
uint64_t type.

CID 195016 (#1 of 1): Unintentional integer overflow
(OVERFLOW_BEFORE_WIDEN)

Fixes: 5b590fbe09b6 ("app/testpmd: add traffic management forwarding mode")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 app/test-pmd/tm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/tm.c b/app/test-pmd/tm.c
index da1adda..dd837cb 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;
-- 
2.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-23 18:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19  9:38 [dpdk-dev] [PATCH] app/testpmd: fix integer overflow Jasvinder Singh
2017-10-23 18:53 ` Ferruh Yigit
2017-10-23 18:59   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).