From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id A4709A05D3 for ; Thu, 23 May 2019 04:08:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 77808A69; Thu, 23 May 2019 04:08:59 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 9FC64A69 for ; Thu, 23 May 2019 04:08:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2019 19:08:56 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 22 May 2019 19:08:56 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 22 May 2019 19:08:56 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 22 May 2019 19:08:55 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.150]) with mapi id 14.03.0415.000; Thu, 23 May 2019 10:08:53 +0800 From: "Xu, Rosen" To: "Pei, Andy" , qabuild , "nipun.gupta@nxp.com" CC: "stable@dpdk.org" Thread-Topic: [DPDK] raw/ifpga: fix unintentional integer overflow Thread-Index: AQHVEGmBF84BnR+Gs0G5QNCvCDltv6Z397Zg Date: Thu, 23 May 2019 02:08:53 +0000 Message-ID: <0E78D399C70DA940A335608C6ED296D73A76E9FA@SHSMSX104.ccr.corp.intel.com> References: <1558506994-350578-1-git-send-email-andy.pei@intel.com> In-Reply-To: <1558506994-350578-1-git-send-email-andy.pei@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzk5ZTNlYTgtNmM5OS00MTgyLWEwZTctNGZkMjliODQ4YTA2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZ0pJTjJLdWxRaTB4bXNUWGYwTmIzbHViTzdoSjN1RWVRZVJcLyt4V1BXQlVncFR4N2p5eUFXMittdzk5ME84K1kifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 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-stable] [DPDK] raw/ifpga: fix unintentional integer overflow X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" > -----Original Message----- > From: Pei, Andy > Sent: Wednesday, May 22, 2019 14:37 > To: qabuild > Cc: Pei, Andy ; Xu, Rosen ; > stable@dpdk.org > Subject: [DPDK] raw/ifpga: fix unintentional integer overflow >=20 > cast unsigned int ports_per_retimer, unsigned int nums_retimer, unsigned > int nums_fvl and unsigned int ports_per_fvl to uint64_t before multiply > operation, to avoid Unintentional integer overflow. >=20 > Coverity issue: 337924, 337926 > Fixes: d1cd4eb2d48e ("raw/ifpga: support ipn3ke") > Cc: rosen.xu@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Andy Pei > --- > drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c > b/drivers/raw/ifpga_rawdev/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 Acked-by: Rosen Xu