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 B5BF2A04A2 for ; Thu, 24 Feb 2022 12:42:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6308426DA; Thu, 24 Feb 2022 12:42:38 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 43D3B4114D; Thu, 24 Feb 2022 12:42:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645702956; x=1677238956; h=message-id:date:to:cc:references:from:subject: in-reply-to:content-transfer-encoding:mime-version; bh=fAV6UhoBuRDYX3SHB9OiYEKvtWuC0msJVkNytHsZapU=; b=Hivzx+nUn0FP5yangV4gBdcKTYYP4ddI+oOK2o1oqg9Wv+ZhhMep6B5S yEWScQRqfHDalVPZrTWe0yArLaymLnP4+IYC3XgKWAjm7L+MaTHcDsj6L l83vkfcmg/Fv9FQeF1NgrRnmP5lpc5lA5c7/T1psXq9xjk59l4eDRHOWB QEEUD2SqgCj1ityxWrge++Sh/I8qJi8rHzN7a5ExJRZG/TYbdidWP9aTx vwnNm8SlbKmV2C3kewLAAcK1mf2BHBcq7uSC/LVAvAwTmZ5AFhF4KT+ac n/i/Yw29vY8MZM7OXEuH3RDVDe2jHyxdwI3OHGXPj0hW5YuTv2Oqd3QOy w==; X-IronPort-AV: E=McAfee;i="6200,9189,10267"; a="239611022" X-IronPort-AV: E=Sophos;i="5.88,393,1635231600"; d="scan'208";a="239611022" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 03:42:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,393,1635231600"; d="scan'208";a="592062138" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga008.fm.intel.com with ESMTP; 24 Feb 2022 03:42:32 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Feb 2022 03:42:32 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Feb 2022 03:42:32 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Thu, 24 Feb 2022 03:42:32 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Thu, 24 Feb 2022 03:42:27 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqQ/qRU2Q1XZxF8U0NQE/yXrSM9uVYUKSkJWj0f8mThrS51M5nT/jlbBNItF6FXydVUsqiR3M2MvA7CG4ex7IYAjcPmIKotvzh3b/Muq5qDZ3CJyNumTBhrrTtCucL683I/hjY/GK2AnESs41CfxRlyVC15X2Egt55y8QQGzdd4Mx3H77ski6EU4J7ZfaBHI+rlnX02gwrhKeetl4+9vnDNIy42i7p5kWz4n1W9Ui0wNfnm+dP3yJKbAVxGCpkbOLcyhhcl9Xv68VmXvOk88izfo3zi3woEdu9J0KrKz6/xrw7KNiG9wsp9bWCpOo82hbFgo+62hs6RBtekulr7RcQ== 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=LiP2EhHdNRtzyajuTghc86CpCy7yERYnda4DfOtLmJ8=; b=lajW5wiHtXbqQWnIrRE5vUTXRYii3WYMfSyG5B5YjDjRLd5y8QUFPQmWF/C2CzW/6iiXbfMuDwZ3JcHQaLErPQXiO6w2lKssVQD7AEXTV31NDXAVgKzjnq1AZ5ulpililY9TkF1jT7iRR8SdQBrnDhDPoNebidOYfabH+wWKGoWpC0ZgO/qpYm6dp37hgGHcLjkZ7rf4nRK72iJcXmENNQ1fCFIzLVprqmJK6p+xyn80eXV/5y7M+Uc3C2POfA0uxwIRgxDvyF/zpPbUTMRU3BxAV9HH4UrIX3AdcDR73ZRQW6MQ9KW89Z9a+fOqhtdNDEoArpPtUU+/CH7qQoBF9Q== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5005.namprd11.prod.outlook.com (2603:10b6:a03:2d3::21) by BN8PR11MB3585.namprd11.prod.outlook.com (2603:10b6:408:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Thu, 24 Feb 2022 11:42:26 +0000 Received: from SJ0PR11MB5005.namprd11.prod.outlook.com ([fe80::950b:2599:c5ab:cfea]) by SJ0PR11MB5005.namprd11.prod.outlook.com ([fe80::950b:2599:c5ab:cfea%4]) with mapi id 15.20.4995.027; Thu, 24 Feb 2022 11:42:25 +0000 Message-ID: <9192567d-77e8-bb81-c677-280163306402@intel.com> Date: Thu, 24 Feb 2022 11:42:19 +0000 Content-Language: en-US To: "Yang, SteveX" , Stephen Hemminger CC: "dev@dpdk.org" , "Xing, Beilei" , "stable@dpdk.org" References: <20220223064147.3512888-1-stevex.yang@intel.com> <20220224011722.3585748-1-stevex.yang@intel.com> <20220223201051.5ed202b6@hermes.local> From: Ferruh Yigit Subject: Re: [PATCH v2] net/i40e: fix unintentional integer overflow X-User: ferruhy In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0108.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::24) To SJ0PR11MB5005.namprd11.prod.outlook.com (2603:10b6:a03:2d3::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab095a00-7e0d-441e-4278-08d9f78aba1a X-MS-TrafficTypeDiagnostic: BN8PR11MB3585: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: utD4UKeZCsRn91vx1GoR50qiW7B265vOYsvLFDaasQHax5i1nM3wwvBK+L+RV/RhtDC3Vm1wkcNXn59tXHWWm58TdYaVuI92wtrjl3/Rrg329OzptFOjhfvJXuHtJnPcK/R2/D7RALj9RHnSBA/R74k2wi2e4t/dlRfHYdQR9uJ2ygXg5wSybOoC7lISP7wnPOLvTzyIlNU1iF9ao4RYd4cgxjG95xabBeSg0s5jdnQFJurv59E+rDWHxZL3GxDA1JbuXjaahwFBpc0znW0JQftScvqVSoJydN3gtQFrsYzStgxLXqeQOxvSezyUl8EZFeZnR7gpLRHvWiMFEIFPch6GNWN1cHduqX/atKfe82WHP/y14c6ld5GOlJhPEAw1mbJc4aAA8Qx0IsVphYcO0e6gfVjTaXAITsKxGFpta5ueysPVSiaT5kvAif8tXr5uhwwyznXre62IBcTF92CqDLYQVeokZl/Z1SLIIUhz/+ip9CUEd0Tz/w6VdGFWYN0vyOgYu5HODgsRSL+maAf49wJvGJC77pfQ/9Kma6xp051mjCK2G6O9HDPd73H34G0qfe48ncYyW26O01E3UmytMNW9mmv2kBOHuXRdwyKgkpzDzBUR4twY/C69jgsBcNnxh/nU/QOoxslClzjIk3AXY+dr+NX1pV6eLRg0P6WNuohnsU5vJB8u+rylVfMOBkt3AsvZQmJjxqw2iC/7c0xlzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5005.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8936002)(66476007)(5660300002)(4326008)(8676002)(66946007)(66556008)(44832011)(2906002)(2616005)(31696002)(38100700002)(508600001)(82960400001)(6486002)(6506007)(53546011)(6666004)(110136005)(54906003)(186003)(36756003)(26005)(83380400001)(6512007)(31686004)(316002)(86362001)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Y2N5SHNtMHBTTUxKVmlvZlNGSjdWMEdlbXpybHBzT04wRGd3aEZ6bTdQNUd6?= =?utf-8?B?Z3h3ZkdkRjdIUGhFZmRiV1lNVUFDemdTTVRSZ1FrVHRudUV6SWxsWVcvUURL?= =?utf-8?B?TDlROFpza1hEQi94VjFVNjlZTVpjYkxLMkhYdVJFS3pldzFNV1NIams0NnA4?= =?utf-8?B?cloxbC9ndHY5bC9uSGVMWTNMMzNqYnhKbE5wZmJQRGdWQkJ0QWcwbFdIUUtS?= =?utf-8?B?anRtNVhVTHdNTFNqVW1NalhqKzArb3pwb2RQckN4T09SNnNTVHpxdGVjNmNk?= =?utf-8?B?UDRIeXFwVHU0b2RHSEZ1cmNzT3pid0krOXk1dmUrRE9RWlF6RWw0RExBNC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YRWNCSW0rTXBUS2tmMVVXY0Y1WTJ2S0hGd2dx?= =?utf-8?Q?dg6kjCNp2r0ESf61tjHuuU4=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: ab095a00-7e0d-441e-4278-08d9f78aba1a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5005.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 11:42:25.1653 (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: CMgRcaNMK+W5fX5RqADmnV8j/NT/Ed/q+n2XmMRQg0B/whFWYdFveMd7MjvN8BJrVPQYGTvLNXQwVqFInPpfvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR11MB3585 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 On 2/24/2022 6:21 AM, Yang, SteveX wrote: > > >> -----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 >> >> On Thu, 24 Feb 2022 01:17:22 +0000 >> Steve Yang wrote: >> >>> 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 = vvm->txq_map; >>> for (i = 0; i < sizeof(vvm->txq_map) * BITS_PER_CHAR; i++) { >>> if (tempmap & 0x1) >>> - linklistmap |= (1 << (2 * i + 1)); >>> + linklistmap |= ((uint64_t)1 << (2 * i + 1)); >> >> 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. Hi Steve, Why not fix this instance in this patch, it is a simple change? Later a clenaup patch can be optional on its own time, but better to get this fix in this release.