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 33E4D45681; Mon, 22 Jul 2024 15:51:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22F7D40655; Mon, 22 Jul 2024 15:51:39 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mails.dpdk.org (Postfix) with ESMTP id D729840655 for ; Mon, 22 Jul 2024 15:51:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721656297; x=1753192297; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=NLNyuSsfG8VIqtcxwPJb/J4B4jSkdL0jvGIVn+5vtP8=; b=RpAUb2B4t1Jee3CpkgCiZgxBoTkspovm1rDEAulJ8dFVqQAIMWFp8qWO Vd4U8GG6X78+/xX2DNl+LNC4xRnw0StI2b2DeXkCgWagi1TU44PG8gnDw /69mWfFznHo/mzuviCKoxstFSOAxY5+jCxT+rMmRnMLAfvOrdLrTmxQk7 TfAXxo1zr6U7KqpFBLlqOC/MBP4x/CHW5XJ6gN9KBm2nvWfl8uaUMwrW4 HBOUGz66C5U1qQCUsdlNsiyvdBh+6VwyA9ZOx50XkQ2QA6GH92ZTefPYt dWsOELos1bArfJPZUjk8sHxHjWr9/c7iH0V9YRswBWfsEbsTOIPNHbkJo g==; X-CSE-ConnectionGUID: bnlcVJllS0yAMLgbqCfC+g== X-CSE-MsgGUID: PDE12BGdR4Co7gopvLC6SA== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="19354228" X-IronPort-AV: E=Sophos;i="6.09,228,1716274800"; d="scan'208";a="19354228" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 06:51:36 -0700 X-CSE-ConnectionGUID: xMVQnPGZRnO3MwMzvc9sBw== X-CSE-MsgGUID: 1hwR8z2YRC2+GvIcGHFPzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,228,1716274800"; d="scan'208";a="51912595" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 22 Jul 2024 06:51:35 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2507.39; Mon, 22 Jul 2024 06:51:33 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2507.39; Mon, 22 Jul 2024 06:51:33 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Mon, 22 Jul 2024 06:51:33 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 22 Jul 2024 06:51:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AXAkgFq6i/U9xNaQDtHWu6y7jnrOND6kQLMcBCOeWUdxcqn2ucOJH4lNZ9AMQZKxH9thWlANrKLIlQhphdFGIfJMnq4IQ3UAUB6ryhUN5NUov/YkXcOiz3D1l1k9sekcpvcjtBEZzp1gWH8VM3eDOkLaRQ1ZQBSV78TnNJpepPfs24ca/YXli6PAg07++Ett3+o7/CUrSoLNwR0wEUhhDXWi8nMPLXMP1qmN6QPrlVAdNCk7AiZSN7bY+qQvb875hMvND8CPjPSWWNzKnD1wHhb39lKJUTrGKMigMCzdIKwATLM1/L16/6CQOkaEMO1HjuLoO9TI1jSTCq/cdygXww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Rl9DQu4rU50/uHN4LDrjjcTNJuIh7OXouYUrfryCmX0=; b=aKXLRJ+AqNtbHQ6G5V411dCLniwDaqEyiiVHrmaFATUgN2n2KE9R29rilsy5oTOhkLQ1iiZjDJ/p3S+YmdtQY4Pi7svhQDaaBzbyBDy19dIDQ1sqSt0ZbTJWwswvCmGg1Y+s7cBHFtD7b3NOZ9YeEFuf0VUY10p/7YC0aB9BZFE1aCdSZZAWYwDfzfHY+HJeC2cUY2Gu+Z0n8sHg4hcQ4xL4rIDtpuWh75zazl07a2Dit5fTyjRRndbObB+L1JxAm1V8J0K96I1rwUpmSiCjwwXA3vIgaRvjYw51qFVeyu8tf+coapTxforFcjvjkr49ZZsCEqXHSDGR0YI9taRmDQ== 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 SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by CO1PR11MB4868.namprd11.prod.outlook.com (2603:10b6:303:90::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.17; Mon, 22 Jul 2024 13:51:30 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b%4]) with mapi id 15.20.7762.020; Mon, 22 Jul 2024 13:51:30 +0000 From: "Medvedkin, Vladimir" To: "Richardson, Bruce" CC: "dev@dpdk.org" Subject: RE: [PATCH v4 2/3] net/ice: refactor raw pattern parsing function Thread-Topic: [PATCH v4 2/3] net/ice: refactor raw pattern parsing function Thread-Index: AQHa3CaHQywC5qa6WkWCc+7VJ85eqrICm1IAgAAoxpA= Date: Mon, 22 Jul 2024 13:51:30 +0000 Message-ID: References: <20240722082836.176515-1-vladimir.medvedkin@intel.com> <20240722105950.199804-1-vladimir.medvedkin@intel.com> <20240722105950.199804-2-vladimir.medvedkin@intel.com> In-Reply-To: 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-traffictypediagnostic: SJ0PR11MB5772:EE_|CO1PR11MB4868:EE_ x-ms-office365-filtering-correlation-id: 4ed92212-4d25-41a6-705c-08dcaa55641b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?hVPqka56w0oMKi82zbdyNCBTdN8fBNjf/Gb6nciONoHwtX3udseKfodbe2Vn?= =?us-ascii?Q?p8UaKuwDH52Rd+NW2I6t3ICY90x0rxUTtfOs5/ojlTovmj4hLyfuclsSqzTC?= =?us-ascii?Q?kRLf7OWRD12KoiKo6Slw/KWR1EguO/75LM41BsINTWSDBFSYArfrwsbeEalO?= =?us-ascii?Q?OGpHfU/CVV40TUndI25jSwTH8axVjegDoNnTexEracnrzm+kP9ZpvxrCTG96?= =?us-ascii?Q?z31tM4tfXR+825k8lKAheNU1Yj6gLPg2oJF5ZV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JBxFzPDEPpVRXftmxwxC3YlDbYcf1Wa6vwC93ldtx9nq?= =?us-ascii?Q?ryVFt5tUYKWYL2GmGihI1cybxFULDNGfS4xZhznwtw1oBAL0M0RrN8Yumlw5?= =?us-ascii?Q?3MchrpoUJGECIuZn9aEAWlN3Co7DDtFNHEBEv133gvrjaOABXzU5pwnl+K/c?= =?us-ascii?Q?NfwLHQ5l798FKSX3eVgNmc1BC9lHCOS02omVqBBkDMFaLuOAhAiZJYcfx5sx?= =?us-ascii?Q?p0kLkLkg3RFu+W7Vmrl0cDIEQUsB9YpdLv0Vewi7w09YBTiX3Q=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?n/068ULIlySw9eBnpCupoybmDQ3B4irrsYMhMeEkXBg08SD7K+PKLG7faDbm?= =?us-ascii?Q?Wfh5z2zwuwZL6Gl6Zo9hSgxoHp0dOXdGWJHTdp4Y4yauxMp8Qd6HlANKlETl?= =?us-ascii?Q?+ZoTFJwnjogMbEKzp8NsWhYJ/TgZD8vckR9/aobD0I94sKevd+JBYhfsg3Aa?= =?us-ascii?Q?1FGCdCgcIy1EVwx22UwoVAWoFTtpUvzsVuJw7je81Y4W5LtWZvJ/9PRJzmHk?= =?us-ascii?Q?TVF4QShNEeUHlmWo8pU/dZpV/lAQs3pCIjDcUmMPS3JgQ/sQaJHuFu3/icga?= =?us-ascii?Q?jr4c+de1TONerQXqq7/Oaos9tZc0HkwgPHi3uK6BywyOj2eDY6EmqcWb/q81?= =?us-ascii?Q?1D4WlqKVoN+9ptDoHrl7Nqq1Rez8hLsVcvudKzrUOS6auYf9dEDC0bPg1srH?= =?us-ascii?Q?tw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wLsstzCQdOXx2HRMkVtHenEwp?= =?us-ascii?Q?lMl6xZLmbzbwPPlX3u6IFYLnyMsXHSASKnEWlH8llDolbXJ8CQOaztL+alti?= =?us-ascii?Q?CFIir6LlF+OPO2bYae0r+uJvwrLW/zinkb7x7ZENGUn6vmoyjU9krCa9pN2y?= =?us-ascii?Q?yMvxsLYkXjgnSibOzzsyHc1mcUVM58mPOR5SqQa7mCImZ7TaupWH5S/tixmx?= =?us-ascii?Q?+Bz/GDq7SSkC6ROo7uMGNCAvlZ0MTjndUO1uFGycEnNWnhSe6Kj4+jjGq0T0?= =?us-ascii?Q?h4ft2HzKNdPlFNMwveoVtF46SyHMATTyqivk+OylszJEdkV3kpEyrCMy/N1D?= =?us-ascii?Q?Qw=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: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ed92212-4d25-41a6-705c-08dcaa55641b X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2024 13:51:30.8108 (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: /ld51v/oh8skRzyE2Vno4cyUpuigZNwZH3nwxMFx6qoE5sCtMyK/ZyHssMjl2+wp7bYhpyOqkSc3L+vFaLUVJh/yFRDiJm56wJ5VpytOaPU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4868 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: Richardson, Bruce =20 Sent: Monday, July 22, 2024 12:25 PM To: Medvedkin, Vladimir Cc: dev@dpdk.org Subject: Re: [PATCH v4 2/3] net/ice: refactor raw pattern parsing function On Mon, Jul 22, 2024 at 10:59:49AM +0000, Vladimir Medvedkin wrote: > Replace strlen with more secure strnlen in ice_hash_parse_raw_pattern. >=20 > Signed-off-by: Vladimir Medvedkin > --- > drivers/net/ice/ice_hash.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c=20 > index 6b3095e2c5..506ea261e8 100644 > --- a/drivers/net/ice/ice_hash.c > +++ b/drivers/net/ice/ice_hash.c > @@ -658,9 +658,9 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, > raw_spec =3D item->spec; > raw_mask =3D item->mask; > =20 > - spec_len =3D strlen((char *)(uintptr_t)raw_spec->pattern); > - if (strlen((char *)(uintptr_t)raw_mask->pattern) !=3D > - spec_len) > + spec_len =3D strnlen((char *)(uintptr_t)raw_spec->pattern, raw_spec->le= ngth); > + if (strnlen((char *)(uintptr_t)raw_mask->pattern, raw_spec->length) != =3D > + spec_len) Are we missing something by not checking the return values from the length = calls for overflow? If spec_len =3D=3D raw_spec->length, then we have an ov= erflow, and if raw_mask similarly overflows the comparison would still pass= and not flag an error. Fixed in v5 /Bruce > return -rte_errno; > =20 > pkt_len =3D spec_len / 2; > -- > 2.34.1 >=20