From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jasvinder Singh Subject: [PATCH] net/softnic: fix integer overflow Date: Thu, 19 Oct 2017 10:39:45 +0100 Message-ID: <20171019093945.126311-1-jasvinder.singh@intel.com> To: dev@dpdk.org Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 27C821B1A4 for ; Thu, 19 Oct 2017 11:27:16 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fixed integer overflow by casting hard_rate to uint64_t type. CID 195020 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) Fixes: 8316b9816b79 ("net/softnic: support traffic management") Signed-off-by: Jasvinder Singh --- drivers/net/softnic/rte_eth_softnic_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 682cc4d..dbb2514 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -47,7 +47,7 @@ int tm_params_check(struct pmd_params *params, uint32_t hard_rate) { - uint64_t hard_rate_bytes_per_sec = hard_rate * BYTES_IN_MBPS; + uint64_t hard_rate_bytes_per_sec = (uint64_t)hard_rate * BYTES_IN_MBPS; uint32_t i; /* rate */ -- 2.9.3