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 0BA32A0353; Thu, 24 Feb 2022 07:21:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C01041155; Thu, 24 Feb 2022 07:21:58 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 70D934114D; Thu, 24 Feb 2022 07:21:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645683717; x=1677219717; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=YDoz174WxY2Y6+5KQ9hlXKaUQcY/g/y0DxdGvwyKP0Q=; b=NEE5bbVPdugSJWBqr36lT0BqJegn//nUfLaCQddDydyb+Md6TC/YDWMc IFu57hn9sHwq6yZdaQasdRZ8T0kun8yimzZsdldne+7ExEwD2CK2it1+h mHqz+2058ujBHUSW9fF8/GJ6czQ/oImfxv2J+po9sZUKvu7sjzk2g1VZy cs+m8TYYWoaX/LqXVkkAiTH5oZOfhYh/NPkn4TeiiTgt9nlCkAHC8jRUk g5usbkaL3dLPk49Y4DSLYv/kvpKeuGVoufrlpy2A/ouj2WPsDA+zK0ArI Cdd6ETMaIwB92l6AWbfe+3/WwU2mWGPMKCeYwRiC7lXy90DsEFyTUXGfz A==; X-IronPort-AV: E=McAfee;i="6200,9189,10267"; a="250989487" X-IronPort-AV: E=Sophos;i="5.88,393,1635231600"; d="scan'208";a="250989487" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 22:21:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,393,1635231600"; d="scan'208";a="508746230" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga006.jf.intel.com with ESMTP; 23 Feb 2022 22:21:56 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 23 Feb 2022 22:21:55 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 23 Feb 2022 22:21:55 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Wed, 23 Feb 2022 22:21:55 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.102) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Wed, 23 Feb 2022 22:21:55 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RXgWC0gobgAo9XMfno4WFHpIhKpdovQXGUcOgxz4w/QPj7kpoGYTMsxC0EMTlhgh5J8U2zIXmlQS7AidFh4cnRXtGZ7Jyz3dunqtwJGF3Jl8wtwPIB3axNJOwwZjNK2qoRUpAm/5DeTlTPqEOELUHLBvRwehYfng84BFltYKMEH66p66RSMZQ+uDpbo48Jcdkmdr2XqgqpTdREXauJ0t3enSVBlxMYJZiDqZyatQt/rc4wG8JQMJltaBBuLs04xqupHSmg8AJYRNlpdY2bbMkK8RL8jneRlJpi/UIMbdYmxEXBZr5DwY2FEBqmLtk4OzjEA8tvkKfJpFVb/40/Ntzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0vFG7wsHWbcuM222tVrs0VcAX+2w1N4eSek0hq7GThw=; b=VF8sA4JLmhQuTo00qLCauwLo1r8gsTKfLIknovdEiRqUkEfitEDhm56B+gJgrmYR45Hhz9Rgst6n0reSwByzC9jyjJ2Sjbb2TkPFNn33VtS4VMhCyT9woUe0hLnOZlP9q3G3FzRCjPYRjz8qfNQRUKDjFJ3RfLu2P2FzVS/fOD/90r4EIjtRIMYhzAGviHF1E5XmH//nByeNTYDMGP7VPSO7Sqs7nglZUFX7wp4bzvSZ1wtRF1b1J9WIJHY42KDOCyn0yGvCyhqQDBRQXBYeGBJU0xT4EW2AhonunnS6c5WPkR/oLPgb8zjPs58j1W3WBfpKmgwNmTd9AdYXSHFlzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4362.namprd11.prod.outlook.com (2603:10b6:5:1dd::27) by MWHPR11MB1342.namprd11.prod.outlook.com (2603:10b6:300:1e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.22; Thu, 24 Feb 2022 06:21:53 +0000 Received: from DM6PR11MB4362.namprd11.prod.outlook.com ([fe80::85c6:ca7d:cd71:d5f3]) by DM6PR11MB4362.namprd11.prod.outlook.com ([fe80::85c6:ca7d:cd71:d5f3%7]) with mapi id 15.20.5017.022; Thu, 24 Feb 2022 06:21:53 +0000 From: "Yang, SteveX" To: Stephen Hemminger CC: "dev@dpdk.org" , "Yigit, Ferruh" , "Xing, Beilei" , "stable@dpdk.org" Subject: RE: [PATCH v2] net/i40e: fix unintentional integer overflow Thread-Topic: [PATCH v2] net/i40e: fix unintentional integer overflow Thread-Index: AQHYKR0tqz0yYMWEQUq+jU7NCIdW36yiFsqAgAAigHA= Date: Thu, 24 Feb 2022 06:21:53 +0000 Message-ID: References: <20220223064147.3512888-1-stevex.yang@intel.com> <20220224011722.3585748-1-stevex.yang@intel.com> <20220223201051.5ed202b6@hermes.local> In-Reply-To: <20220223201051.5ed202b6@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d8db2889-7545-4d31-0f12-08d9f75df331 x-ms-traffictypediagnostic: MWHPR11MB1342:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VXHb4riBs+kpP9/tcXa4OdCONYzPKpJF6+Sw5SFlo7lcFlpaMKL8axLxMkshZhiMhEy/Fxk/kGGMJukcje5xteXIlmgbSTvhG1DruRSxV2qKXaQrTHvj2akg9x6kdqnSQ23jxeu3/ob9Im6Ey5boMicamvej8VSKdhYTLctqEl0WUBiuvewyd0PiHflJZQJiccoKpzRKaH4LHDsCfs/SvylibKPiwetxagtojb+8l76WQY1T/7fy3tFdtw2TIamq5b+N4IBGbgw6p45CUxaPmSxp8rHbVn/I7R+uhC7OypC0HnzzEef3vba1HwJQPam1dLXtaU5kbUQX/oX7XZei19ySy5GOpdX+hYrkhoI+nZVWVzcjYOdk1QGnRA3Zs/h7VsXbAxjm9+Mr0OAH1GZes/2kz/A9vfffNcjIUQjqjHDa70U5WWWDp1Sn+M2ngeZjbqa94Bfd8pddHAZ9+tb7dGD7A81x8v7YaSu56faVxXYP9DZ4/vmgcNf0oU2HwBZeQ5dvTYHnYijFrJqDXkqmkehM20emmfeBfmeUK1M3ewYl4JOYZxVFptlMHsZ+erSkrQYXV4hMY9ImDxDySm7cnXucpx+ifWDFNRdjrSEsRWcpRTrFr8CHtxlR2lCqfLDUEpFOFI1IOe8PHZNSVw9YeS2dwPa7rDJrSD0Lxa7fRwvw0cctihcoaa9ZTTUb4eyH+6KDl1THTpvfc3nKI+OzcA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4362.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66446008)(64756008)(8676002)(122000001)(316002)(76116006)(66946007)(66556008)(6916009)(54906003)(508600001)(66476007)(82960400001)(4326008)(38100700002)(86362001)(38070700005)(33656002)(6506007)(8936002)(71200400001)(2906002)(26005)(186003)(5660300002)(52536014)(55016003)(9686003)(53546011)(7696005)(83380400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?lEsNtCTsVgBwdADXl2Bh0HaMBCv3xTZkt5s+vRqPu07z2jWB/o5vY7lSoUOW?= =?us-ascii?Q?vHj++i4ca5/KGYHHezF+DHn8xo6IOr+zKKL4lc9ErldIxXunVdnX+lVqNOSM?= =?us-ascii?Q?BsK8GN/2hLzXI5BKdsCWBoObhRbuGbrK1DikNSujEkSZS2hivFIyc7Vlpx0E?= =?us-ascii?Q?Q//5kU3TLagc83mI9YJo8UP3icGzpu4HqL/soUPEzKijfkbCySrHPIzyroWe?= =?us-ascii?Q?JipMhbHjzf6pAMuHoWDZOVV+NQ1SjZPfZU5zN2D+8V+Alz96vhI+2dcxaz9X?= =?us-ascii?Q?WOP/SL4NtiE5lnKC5p25+Ma9EYioxiBWp4qvo8Lg8T+qXRESPmw5Zz0LGF5g?= =?us-ascii?Q?MJQd69YrCfUR69j9sX08hWF3tCuPXl1UqiuUs95iOJcHW7o+dX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M0Y6il3c8PTKPfihAjbLvXOD0OqoQzkzhVnGvAmijCth?= =?us-ascii?Q?kwAGE2QKvvlW+zXCaWBcj5/X4szc8WevA/1JHS7ZEFFkoOM2z9QaaL8lQaFk?= =?us-ascii?Q?wRkpTRgiOiIPzfFDgwndfTjvBjDOhpEtYSgmardwoUvWs+/YnE5WP/0JAAfR?= =?us-ascii?Q?3PFF+D8VuaTEExgCrT2X/U+CQcffHxzbX3CPKOm5ddV0P/8BvErsnv9w5G/T?= =?us-ascii?Q?63c05bYWCYEFSyJGGHqlzyKhXAtf80Sxaq8TYKRbBsQ60PgIFWsmYWWPGVcU?= =?us-ascii?Q?KNtfqgkayblE59Xvw2y9E6cDn5oiEUWjGVXV/HLLahEBll4EonTSxRW+w4CS?= =?us-ascii?Q?/A=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4362.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8db2889-7545-4d31-0f12-08d9f75df331 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2022 06:21:53.2796 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SbFG1y2wNYXmwxn3nb9mORBB4IUkP9/XMTAFiFVjq70s7NpC+JOQj56AOPq768LzOlLXWHOevBqRv3Y1sSCW7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1342 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Stephen Hemminger > Sent: Thursday, February 24, 2022 12:11 PM > To: Yang, SteveX > Cc: dev@dpdk.org; Yigit, Ferruh ; Xing, Beilei > ; stable@dpdk.org > Subject: Re: [PATCH v2] net/i40e: fix unintentional integer overflow >=20 > On Thu, 24 Feb 2022 01:17:22 +0000 > Steve Yang wrote: >=20 > > Cast 1 to type uint64_t to avoid overflow. > > > > CID 375812 (#1 of 1): > > Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) > > overflow_before_widen: Potentially overflowing expression 1 << 2 * i + > > 1 with type int (32 bits, signed) is evaluated using 32-bit > > arithmetic, and then used in a context that expects an expression of > > type uint64_t > > (64 bits, unsigned). > > > > Coverity issue: 375812 > > Fixes: 5fec01c35c49 ("net/i40e: support Linux VF to configure IRQ link > > list") > > Cc: stable@dpdk.org > > > > --- > > v2: update commit message. > > > > Signed-off-by: Steve Yang > > --- > > drivers/net/i40e/i40e_pf.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c > > index 2435a8a070..39e0c021a4 100644 > > --- a/drivers/net/i40e/i40e_pf.c > > +++ b/drivers/net/i40e/i40e_pf.c > > @@ -604,7 +604,7 @@ i40e_pf_config_irq_link_list(struct i40e_pf_vf *vf, > > tempmap =3D vvm->txq_map; > > for (i =3D 0; i < sizeof(vvm->txq_map) * BITS_PER_CHAR; i++) { > > if (tempmap & 0x1) > > - linklistmap |=3D (1 << (2 * i + 1)); > > + linklistmap |=3D ((uint64_t)1 << (2 * i + 1)); >=20 > Could be RTE_BIT64(2 * i + 1) instead? Thanks Stephen, excellent suggestion. Current code exist lots of similar nonstandard bit expression, I think it maybe better to start a new patch series to change them.