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 2580E45843; Fri, 23 Aug 2024 09:29:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF6ED42FF5; Fri, 23 Aug 2024 09:29:15 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id AE27940150; Fri, 23 Aug 2024 09:28:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724398125; x=1755934125; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=n5C9Nvp2biSi4jugkcZqEaaXJC2ecZeeoVIdiot2OS8=; b=F7vb0pxLYUap7EktPyNuVONNCYhbOZhuyTtBnR/o2y3BOC6WWwrs20D3 MJviTXEZNYloiMOgnnU+9SdYK6VQF6pgQVvJ3RuWLhDIpiDEMq1j2iPrd M2sX2frKMe7PVplAoxTPy1483frAsOd67AMralszhKNkhQrovtevCBMvn Ib2vNgJ/7YutMAZznjXDV8Rrrm+VNGWSR6bafinAJiej9tvtBj5QTAwOR RCbikuU/iBOXSTUIoloKIt5pv88k9NTOGANj9+gFNZxJUMv3BnoNmi8XL sZg4QZBSoWz3RJQQs7s5x7ZUf3w+hWgIdiHLiAVPD8w7fAz9LLM8qYq/B A==; X-CSE-ConnectionGUID: UpH7IW14RVKrfMxqYqXsqw== X-CSE-MsgGUID: +IMKXIuhRPK8PHIPN8mecA== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="22449109" X-IronPort-AV: E=Sophos;i="6.10,169,1719903600"; d="scan'208";a="22449109" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2024 00:28:43 -0700 X-CSE-ConnectionGUID: mN4bHmAxRvWK1yEPnl6SnA== X-CSE-MsgGUID: gB9Fu7CzSD2CIf+8rZMutQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,169,1719903600"; d="scan'208";a="66042214" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmviesa005.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 23 Aug 2024 00:28:43 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 00:28:42 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 23 Aug 2024 00:28:42 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 23 Aug 2024 00:28:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U9v2iekYdmJ9I/MxqMxZ0ZbTWMbguUQgXKz7cF21fv964YtZfb5vegtdurFY6lkOB9eTde8LOMCkd+Yq3tM+lJU5mcGTkzjhI6peJzilT3VKQoQRzEi8j0gMMT1b6apLcRNlO/rsj9sDyv6y7BlghOEYF+pPSISj1/bIzSDXNT6+IGv34H4S2zgbN+xJbsw+H4k4NG7y7rutTL5seNs7DDH/9iHQWsGGZegovQJg4wBLoDFYsk2gnqR9PYlZ1odqYczKujxbTy3K8U9+/Djlsg/Kj30NW+3zpCMC5bAozOXHOYG59KHNGTZK+/wEP1MgdiCbZhcGnBqyLz9vfYYpyg== 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=vrxdHBT7ue9VrykthtoLo7IoMsnfXxN8D/QpO6BfZfc=; b=ya9KbruKszpwXsSRm/5S0bIWgR5OwV2iWNtLJAU1d85wL20kx8BPfPUJXPmt8enPst0Ittr3yCqDPvaAlODF3BSBlVQS1zXBP00Wqcm7IOfuTOuZE35FjrjHNaNgGUP4X010wIMGYvRpeHaWhw0yUexAzK6eFxaNHYGZeanm+BwkBrjCcLvJzh+BYsV6go3cS8/tQSP/VGGlrLA09L1T1l3NwGugO/o/fAclkxim8/pQFo3sm57UOAHA72SLnGosVDxE7WfGMJLn1HppzhbPxJ8/y0LvBnHHonOKbHqAzbBRbqCNzZcbuNaudXDcRmv6R0keFgzlIY18z3GTILfWEA== 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 MW4PR11MB5911.namprd11.prod.outlook.com (2603:10b6:303:16b::16) by DM4PR11MB5229.namprd11.prod.outlook.com (2603:10b6:5:39f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Fri, 23 Aug 2024 07:28:33 +0000 Received: from MW4PR11MB5911.namprd11.prod.outlook.com ([fe80::1d00:286c:1800:c2f2]) by MW4PR11MB5911.namprd11.prod.outlook.com ([fe80::1d00:286c:1800:c2f2%6]) with mapi id 15.20.7897.014; Fri, 23 Aug 2024 07:28:32 +0000 From: "Shetty, Praveen" To: "Richardson, Bruce" CC: "dev@dpdk.org" , "stable@dpdk.org" Subject: RE: [PATCH v2] net/cpfl: fix cpfl parser issue Thread-Topic: [PATCH v2] net/cpfl: fix cpfl parser issue Thread-Index: AQHa4xu/5YIQP8OV8kuLjnszlWKs9rIzoJ0AgAD07ZA= Date: Fri, 23 Aug 2024 07:28:32 +0000 Message-ID: References: <20240730050952.837611-1-praveen.shetty@intel.com> <20240731072303.1119177-1-praveen.shetty@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: MW4PR11MB5911:EE_|DM4PR11MB5229:EE_ x-ms-office365-filtering-correlation-id: 5ade01b0-f794-4b6d-9339-08dcc345311e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?dtYVx2qxJ2I/LK60crdIX5vK6aTjqXMBw1BONf/GqexUs974iaS3AwDK4kl2?= =?us-ascii?Q?xXMdHftiYw40Z+rIbB9fJFiK8XzfI1I30UojtoLFimNEAmrwLdSUsE4+hPtG?= =?us-ascii?Q?zBG1r0QXf/+bsNliVPA7sVefZE9w0/8VUMTQzAQIQiNYYJDNvhy7QhOMbDqG?= =?us-ascii?Q?MNWV2D7eVCeWsC9FlEBo0g4dnZN8YhMXENgbIePJ60Si7h8YxuvtymHhRANZ?= =?us-ascii?Q?uzbNgzXo91mRxQ3GAE4SyS8XoZ9a2siiM0DpZzQGHfm5+cQ12nFSlPRkRUwX?= =?us-ascii?Q?Y2qrGTBd//RUEiK7ZhysO5xhPl0W4hHhNwMNiria7Ek8QDwq6o1p73VGemDO?= =?us-ascii?Q?QvzS5rgB0LbBKnwm7KtXT6UROWai4eVFTe32oWk4TJQKFBY42guxMg9CjRlb?= =?us-ascii?Q?LJcuwnTGg8rs3KQCsNbLy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?= =?us-ascii?Q?BWnS6AvUKUcBK4KTUFbPurQ+pp5FLD7PjfQimUy9C82fSCDK3kon7SC56lTK?= =?us-ascii?Q?x+Yw5SMY6pkU+IPQ1evOGAM1s62yqfXfRelap1K17IdSqCVxxw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5911.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?jSGCshvDHuHdYsUDOgKp5YisoIKpqRynyiilmyfnXRCn26uUIvMrd9LdnIuk?= =?us-ascii?Q?o/mmU8n7lYB42i8AWkzrTvR/nwHK0chEDqR1HHQePC1B/3Mos1eLU7ozivU2?= =?us-ascii?Q?aup33vZmzW6j0YTKDS4tCrTHGHHKfis9aU4GDCExLWa+IKsDu9y650yCLwKc?= =?us-ascii?Q?5RUU3NZfZqdccUv3dsyd7YAk5wkmvn7lCx8FJLKp7Mk2XOnvJBro7d9aNP6S?= =?us-ascii?Q?qNHtFFiRWaSEBWt6Shobq8+mD+lFDVangOcJMmc6S9muOTbpKwLA+aSWfVVl?= =?us-ascii?Q?05ZLB+8xJl0UhsZHved1FUX4zocT7CVXXbLq11/fvOkSLl9DO9K82o2lQtFj?= =?us-ascii?Q?b6uRotgsyljaKcbJ2iBepzvE7TwLQW8ZTnheykGoaHlGmQYrm6OGfAS3LkoE?= =?us-ascii?Q?9dRiQnnXqM3jo1PIhc019EgOuKv1UIL31qXNnsOqBwNv/m44BhXpoQ2WZN49?= =?us-ascii?Q?Y3DtTiDf3L7v3ejTXpP4iLBW6ioyyvZpW8SxCmS/3T9ULzvAJswXZYKM/fe5?= =?us-ascii?Q?yNezmKvoaKU9D0kTyvihjlQu4Fr3thiXd3flVIpnI74ZntK+8NVlHSW35fPK?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nZLbOvU69KJTWN2w6R5Pl2v6tj0Q3?= =?us-ascii?Q?/5N09q4aJ1kAfRL50ZDWT8NbNIxOKvvfsHKQF/uxPMON6LZPLpmfGHZ/Jy/6?= =?us-ascii?Q?p9OVOTLtVVaddzEDxJWp/eRqQ3/RZE5OvGriPD1R?= 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: MW4PR11MB5911.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ade01b0-f794-4b6d-9339-08dcc345311e X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Aug 2024 07:28:32.3419 (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: LJa8JkeYxeuQIN3gE3zEiNt6mJahtHo+5ZVZJqJScucPaw+FMyGpNNAevrGtxAImnCF+ZanCeHpEMvTE3k5V1Fnj33/ntiveCTgLmf07geo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5229 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 > CPFL parser was incorrectly parsing the mask value of the=20 > next_proto_id field from recipe.json file as a string instead of=20 > unsigned integer. >=20 > Fixes: 41f20298ee8c ("net/cpfl: parse flow offloading hint from JSON") > Cc: stable@dpdk.org >=20 > Signed-off-by: Praveen Shetty >=20 > --- > v2: > * Fixed CI issues. > --- > drivers/net/cpfl/cpfl_flow_parser.c | 34=20 > +++++++++++++++++++---------- > 1 file changed, 22 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/net/cpfl/cpfl_flow_parser.c=20 > b/drivers/net/cpfl/cpfl_flow_parser.c > index 40569ddc6f..7800ad97ea 100644 > --- a/drivers/net/cpfl/cpfl_flow_parser.c > +++ b/drivers/net/cpfl/cpfl_flow_parser.c > @@ -198,6 +198,8 @@ cpfl_flow_js_pattern_key_proto_field(json_t *ob_field= s, > for (i =3D 0; i < len; i++) { > json_t *object; > const char *name, *mask; > + uint32_t mask_32b =3D 0; > + int ret; > =20 > object =3D json_array_get(ob_fields, i); > name =3D cpfl_json_t_to_string(object, "name"); @@ -213,20 +215,28 @@= =20 > cpfl_flow_js_pattern_key_proto_field(json_t *ob_fields, > =20 > if (js_field->type =3D=3D RTE_FLOW_ITEM_TYPE_ETH || > js_field->type =3D=3D RTE_FLOW_ITEM_TYPE_IPV4) { > - mask =3D cpfl_json_t_to_string(object, "mask"); > - if (!mask) { > - PMD_DRV_LOG(ERR, "Can not parse string 'mask'."); > - goto err; > - } > - if (strlen(mask) > CPFL_JS_STR_SIZE - 1) { > - PMD_DRV_LOG(ERR, "The 'mask' is too long."); > - goto err; > + /* Added a check for parsing mask value of the next_proto_id field. *= / > + if (strcmp(name, "next_proto_id") =3D=3D 0) { > + ret =3D cpfl_json_t_to_uint32(object, "mask", &mask_32b); > + if (ret < 0) { > + PMD_DRV_LOG(ERR, "Cannot parse uint32 'mask'."); > + goto err; > + } > + js_field->fields[i].mask_32b =3D mask_32b; > + } else { > + mask =3D cpfl_json_t_to_string(object, "mask"); > + if (!mask) { > + PMD_DRV_LOG(ERR, "Can not parse string 'mask'."); > + goto err; > + } > + if (strlen(mask) > CPFL_JS_STR_SIZE - 1) { > + PMD_DRV_LOG(ERR, "The 'mask' is too long."); > + goto err; > + } > + rte_strscpy(js_field->fields[i].mask, mask, CPFL_JS_STR_SIZE -=20 > +1); +1 for replacing strncpy with something safer, since original code is=20 +wrong and can leave a non-null-terminated string, but unfortunately the copy here= isn't quite right. For strlcpy and rte_strscpy, you specify the exact buff= er size, not the size-1. Also, you don't need to check the length and then do the copy, you might as= well just do the copy using strscpy or strlcpy and check the return value = from it. Saves iterating the string twice (once for length, second time for= copy). For example: if (rte_strscpy(js_field->fields[i].mask, mask, CPFL_JS_STR_SIZE) < 0) { PMD_DRV_LOG(ERR, "The 'mask' is too long."); goto err; } Thanks, will fix this in v3. Regards, /Bruce