From patchwork Thu Oct 19 09:38:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jasvinder Singh X-Patchwork-Id: 30576 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB0C21AEF4; Thu, 19 Oct 2017 11:25:46 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id CBD701AEF3 for ; Thu, 19 Oct 2017 11:25:44 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Oct 2017 02:25:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,400,1503385200"; d="scan'208";a="164444527" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by fmsmga005.fm.intel.com with ESMTP; 19 Oct 2017 02:25:42 -0700 From: Jasvinder Singh To: dev@dpdk.org Date: Thu, 19 Oct 2017 10:38:18 +0100 Message-Id: <20171019093818.126232-1-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [dpdk-dev] [PATCH] app/testpmd: fix integer overflow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 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 Reviewed-by: Ferruh Yigit --- 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;