From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D4EB7A0487 for ; Thu, 4 Jul 2019 09:16:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E11625B3A; Thu, 4 Jul 2019 09:16:31 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id BA4582C38; Thu, 4 Jul 2019 09:16:30 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2019 00:16:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,449,1557212400"; d="scan'208";a="166201682" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 04 Jul 2019 00:16:29 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 4 Jul 2019 00:16:28 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 4 Jul 2019 00:16:29 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.232]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.240]) with mapi id 14.03.0439.000; Thu, 4 Jul 2019 15:16:27 +0800 From: "Pei, Andy" To: "dev@dpdk.org" CC: "Xu, Rosen" , "stable@dpdk.org" , "Zhang, Qi Z" Thread-Topic: [PATCH] raw/ifpga: fix unintentional integer overflow Thread-Index: AQHVEGpmbz1BSPkFsU+NNEdOeLzfPaa6T8Tg Date: Thu, 4 Jul 2019 07:16:26 +0000 Message-ID: <5941F446C088714A85408FA3132CFCBB0104439C@SHSMSX105.ccr.corp.intel.com> References: <1558507369-350703-1-git-send-email-andy.pei@intel.com> In-Reply-To: <1558507369-350703-1-git-send-email-andy.pei@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] raw/ifpga: fix unintentional 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" +Qi -----Original Message----- From: Pei, Andy=20 Sent: Wednesday, May 22, 2019 2:43 PM To: dev@dpdk.org Cc: Pei, Andy ; Xu, Rosen ; stable@= dpdk.org Subject: [PATCH] raw/ifpga: fix unintentional integer overflow cast unsigned int ports_per_retimer, unsigned int nums_retimer, unsigned in= t nums_fvl and unsigned int ports_per_fvl to uint64_t before multiply opera= tion, to avoid Unintentional integer overflow. Coverity issue: 337924, 337926 Fixes: d1cd4eb2d48e ("raw/ifpga: support ipn3ke") Cc: rosen.xu@intel.com Cc: stable@dpdk.org Signed-off-by: Andy Pei --- drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_ra= wdev/ifpga_rawdev.c index 41be1a2..9c68666 100644 --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c @@ -494,8 +494,8 @@ if (!strcmp(attr_name, "LineSideLinkPortNum")) { if (opae_manager_get_retimer_info(mgr, &opae_rtm_info)) return -1; - uint64_t tmp =3D opae_rtm_info.ports_per_retimer * - opae_rtm_info.nums_retimer; + uint64_t tmp =3D (uint64_t)opae_rtm_info.ports_per_retimer * + (uint64_t)opae_rtm_info.nums_retimer; *attr_value =3D tmp; return 0; } @@ -547,8 +547,8 @@ if (!strcmp(attr_name, "NICSideLinkPortNum")) { if (opae_manager_get_retimer_info(mgr, &opae_rtm_info)) return -1; - uint64_t tmp =3D opae_rtm_info.nums_fvl * - opae_rtm_info.ports_per_fvl; + uint64_t tmp =3D (uint64_t)opae_rtm_info.nums_fvl * + (uint64_t)opae_rtm_info.ports_per_fvl; *attr_value =3D tmp; return 0; } -- 1.8.3.1