From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0FE6FA0A0E; Sat, 8 May 2021 03:53:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 87B6D40140; Sat, 8 May 2021 03:53:34 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 6B3414013F; Sat, 8 May 2021 03:53:32 +0200 (CEST) IronPort-SDR: VF0g+0idMOFx+X3tK4mN/g+D+nGLX1/wW0AYlKr2mKei5yQXg44/N702CmJHDa4mI1MfcfitIs sW6WIWN9YNJQ== X-IronPort-AV: E=McAfee;i="6200,9189,9977"; a="179094644" X-IronPort-AV: E=Sophos;i="5.82,282,1613462400"; d="scan'208";a="179094644" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2021 18:53:29 -0700 IronPort-SDR: p/QA+ggQpnFMIpJcGsstyYIp1wNAxWLLMcnbjRvCoxGZpUoENUBCDVaZqrv2KF06mJSQnB9BHt AFCKltW4A3mA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,282,1613462400"; d="scan'208";a="466229678" Received: from irsmsx603.ger.corp.intel.com ([163.33.146.9]) by fmsmga002.fm.intel.com with ESMTP; 07 May 2021 18:53:28 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by irsmsx603.ger.corp.intel.com (163.33.146.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Sat, 8 May 2021 02:53:26 +0100 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2106.013; Sat, 8 May 2021 09:53:24 +0800 From: "Zhang, Qi Z" To: David Marchand , "dev@dpdk.org" CC: "stable@dpdk.org" , "Yang, Qiming" , "Yigit, Ferruh" , "Lu, Wenzhuo" Thread-Topic: [PATCH] net/ice/base: fix mem allocations wrapper Thread-Index: AQHXQl+dyq4gJDU2hky+6pS5t7gKo6rY1POg Date: Sat, 8 May 2021 01:53:23 +0000 Message-ID: <6635024c9de94923ae24e529226c543c@intel.com> References: <20210506100702.23778-1-david.marchand@redhat.com> In-Reply-To: <20210506100702.23778-1-david.marchand@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/ice/base: fix mem allocations wrapper X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: David Marchand > Sent: Thursday, May 6, 2021 6:07 PM > To: dev@dpdk.org > Cc: stable@dpdk.org; Yang, Qiming ; Zhang, Qi Z > ; Yigit, Ferruh ; Lu, Wenzh= uo > > Subject: [PATCH] net/ice/base: fix mem allocations wrapper >=20 > This is reported by our internal covscan: >=20 > 1. dpdk-20.11/drivers/net/ice/base/ice_switch.c:4214: sign_extension: > Suspicious implicit sign extension: "s_rule_size" with type "u16" (16 bit= s, > unsigned) is promoted in "num_unicast * s_rule_size" to type "int" > (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, > unsigned). > If "num_unicast * s_rule_size" is greater than 0x7FFFFFFF, the upper bits= of the > result will all be 1. >=20 > # 4212| s_rule_size =3D ICE_SW_RULE_RX_TX_ETH_HDR_SIZE; > # 4213| s_rule =3D (struct ice_aqc_sw_rules_elem *) > # 4214|-> ice_calloc(hw, num_unicast, s_rule_size); > # 4215| if (!s_rule) { > # 4216| status =3D ICE_ERR_NO_MEMORY; >=20 > Even if this condition is not likely to happen, in any case, it is more > straightforward to rely on the existing rte_calloc. >=20 > Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation") > Cc: stable@dpdk.org >=20 > Signed-off-by: David Marchand Acked-by: Qi Zhang Applied to dpdk-next-net-intel. Thanks Qi