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 31B09A04FD; Fri, 25 Mar 2022 07:33:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D5AFA40140; Fri, 25 Mar 2022 07:33:30 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 014AE4013F; Fri, 25 Mar 2022 07:33:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648190009; x=1679726009; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=EYR+WlyDVqcbJAWhf43uu9+gIQ/LN2/KBF8H7peax4k=; b=jWpNl1RtbcQ3id/DpUpTAmxTQhc31Z9EjJhr7CAWLiACrXS412AsihqF amj+F5RPa2aR5n/iLV47r5XgEYdh8kv9LsofDEQsKiVzEDXb6toiFHXPN LIGvzJWPnE0tncN31cp0CvVQFc+L43p61aIKguH+v7IdmOTpm/EzF9L88 mngVcEkVedKfxAzVXH7dAAVaozRYsNT6TybqX0x5T9KfLwfoa7/+pXO+9 Eguqf1sJceCy/F5+oeDV6STIdrBPjAE/JlEPu7gRT7pi+aWNiyE01rRBr Ks5ZqBPX/1dQ4Inv2u4G48Wrg/sPRK3cziNIfG7Zj5XZEBuakXBJnwLDl w==; X-IronPort-AV: E=McAfee;i="6200,9189,10296"; a="238507804" X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="238507804" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 23:33:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="553127672" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga007.fm.intel.com with ESMTP; 24 Mar 2022 23:33:27 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) 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.27; Thu, 24 Mar 2022 23:33:27 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 24 Mar 2022 23:33:27 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) 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.21; Thu, 24 Mar 2022 23:33:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EzsHl+A1qI29WfIirdvKgJoyG+simx/calTT2qgebCXh/LSLRZrZtmhY3BSxUrPSQxcSzNMHsFJmKyGU5VSqh55nDgnVUZszWsQHIbsFCSmJrI5Uyg3qERE/K17ySO1TA0ivt1qfMsLlqCHCXn0qj9zpnqOCaxHgE/6Pc+Lu9/4+hWX5OUBlepw95GV0A37Vbo0WgRiHCH68hGO3m89jR/sHVHdCDkBz1L/iGH8jUhRRAif5GuwhqZ9XbYa6b2CYn0ogFt/NoC1eRzQBhDcFbZ6zM4veuPcTx7CyMKOSWRO41M3AaDKdPMQcGjHgt5TwdkE5CB+mc0zcN2IUA1B80A== 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=b96swNDrLewNGXi7T30U4MXycGK6rv95NSAeSttF4J0=; b=ThUlVr9hA16I1BepJNS/b/3SphLpUrDsk37VDx8L5vWrkPDX7lP/W6cpdCXfpDfKG5hQe7pYsHUZ7OKP3uAImRW6EQdzEyMmlS3eB5AeJ6H9Vffjjp69hE06IQqL5lAP91bjds0cXNqCpWr34gx+MTr4ZXbxVd/2GRG19O3ff/VA9eDcGc57QqWEKCmfAeg9yaywPs4zKA8a9zh6af5GBnFs9QLotX5Si2c84sBjm1AJjXje1cILdckN9vwxmH4nMlnX1A1goTp5xQ9AZ/7zacuIkXXaWJJ1gaOG7D4aOCnFJ6hZJAMGYMhYRB6GxDgdOz2gWxm+38t1uQT4pykEUQ== 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 DM6PR11MB3723.namprd11.prod.outlook.com (2603:10b6:5:13f::25) by BN6PR1101MB2194.namprd11.prod.outlook.com (2603:10b6:405:55::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.22; Fri, 25 Mar 2022 06:33:24 +0000 Received: from DM6PR11MB3723.namprd11.prod.outlook.com ([fe80::8ce5:e41c:9de6:d027]) by DM6PR11MB3723.namprd11.prod.outlook.com ([fe80::8ce5:e41c:9de6:d027%3]) with mapi id 15.20.5102.016; Fri, 25 Mar 2022 06:33:24 +0000 From: "Guo, Junfeng" To: "Xu, Ting" , "dev@dpdk.org" CC: "stable@dpdk.org" , "Yang, Qiming" , "Zhang, Qi Z" Subject: RE: [PATCH] net/ice: fix raw flow input pattern value change in FDIR Thread-Topic: [PATCH] net/ice: fix raw flow input pattern value change in FDIR Thread-Index: AQHYOnZyQsQir9bBu0WN1QHWofM/xKzPrkeQ Date: Fri, 25 Mar 2022 06:33:24 +0000 Message-ID: References: <20220318031650.2580-1-ting.xu@intel.com> In-Reply-To: <20220318031650.2580-1-ting.xu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.401.20 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: 793efa7a-1202-4780-2120-08da0e295cfd x-ms-traffictypediagnostic: BN6PR1101MB2194:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr 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: xaqI/lCUT8nPuicstjGDu4vSKAFsl9G0oPtjI2biANVnvFb9QFCxvDHeMhjJ963mDMVxHwFOFpRjhEtwiXyKgHLmuXSxtstigoiHwYGs9dkRhPG1Z+u5bRAz65kgF6cfCo3cGBbRaI2HVEmdU9k/8eBZWeSDfLKuHQ1bqVnwcz1bhebzE8LjxflEcTfg57QsTH96hKRsChaP0RoozEWlPMcXhD2Fgta4Pm33nXw9IalJsiGd2jN6qg/qV4gnxCCGcy0CCSeALeIsBt4srVwTZysczfHv354YiYC21u4arqxAe9A1quZdf68MnR5ubojWlQ4Im+F1gAzsIOuvHDCE3m/YG/anFIYsCr7qPYI2gEoe1smzkasNTNvzwdcw0VAxpgzvCd3hEnowy3+NVvEsijg6x0X2d/E7oVcApXCq8j+wk4Yu1C0aVuN+ZyMY1VX0us5FJacxSCChpWhV6gGOjR8JeQcgAftUBqYoqIrKGCXIyljLKJGv1ctxGKWOsdwJ0qaQ3WE6MWj0D6+d1aMPaNHIm9ebkKQthWbLcJgCwofqcZcleEWZu+qpBwA4vSTsXwGhqrck+FgyVuHmedX3WstKVG5pKb8EMvqaiToMR1P73lVmAH4Zuv27xI8QDPL+aV5jJnYOgioNowIikabB1jVmyo7FwonPnXj0vGHk8yej7A///yx1NRQSdvnzbSMHE2vk85fxq7SCBBmIe9W1ew== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3723.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(107886003)(186003)(86362001)(316002)(5660300002)(76116006)(8676002)(4326008)(26005)(66476007)(66556008)(66446008)(66946007)(450100002)(52536014)(64756008)(83380400001)(110136005)(8936002)(122000001)(2906002)(54906003)(82960400001)(38100700002)(38070700005)(9686003)(55016003)(53546011)(33656002)(508600001)(7696005)(6506007)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ScDax1GPSW/i0Du2V7lvyjUwWLlLMIOS+2YtdMk4xKRTDlipj9I9hNCFVr+e?= =?us-ascii?Q?WdJBuLWNCQWrMaezbrjkOnNsJVXsssxoFH2QQe8M6I6Ssy36t5buNdZnphn2?= =?us-ascii?Q?FfaxVo2WnmjYc03cojhIoCPlgzkR3tPSe7j0Es/PCHhq44RAxZ/GL+j0c2R9?= =?us-ascii?Q?KxZL1LXAvLThnQikv0GcvTYVHfE3L6fFRQsM5UqfmX7Cx0xNAJu1eo7xJ8lA?= =?us-ascii?Q?n+hEykN1uD7XJCWNf6mbrE9j3AxKqhmOyr75pw38Q78MxiKmFbG7++dIougn?= =?us-ascii?Q?1M1r1lrA/6FVlPs/ArTR9DZS4vuiTJZoLrhzqNwD+TjimpoV7Cfd2QjNHSXb?= =?us-ascii?Q?KeJKgFqdZ70QpjlL1rAR9sba/6MfpkuNe8rpMJ1h9TFLP5eywoeuZQhOKYrW?= =?us-ascii?Q?Jv8YYZ1BSAd23JeA7X5S8sLJrdduSESLTSKnF0M0BkyJ3ebGDFbfMPp6zBHf?= =?us-ascii?Q?BMwgmmXQ+DRyWrt7ZM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ii?Q?NK1P2oCH1673xfdaTasrIe0dSgPX2q6/ynYgwQqNWpSKVR7JvE35QVMQKe/b?= =?us-ascii?Q?hz0CkPW0PxVwsX1SpgtawYpRAnV+BHvk?= 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: DM6PR11MB3723.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 793efa7a-1202-4780-2120-08da0e295cfd X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2022 06:33:24.2106 (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: r0PdA4JRCjj+2MSmP6uZbuEVj87H3A3kaFJ8BSdXQts6s8rayR2SfmMeOdWs7jzN/Z99Pj6equJi7gvtterR7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2194 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: Xu, Ting > Sent: Friday, March 18, 2022 11:17 > To: dev@dpdk.org > Cc: Guo, Junfeng ; Xu, Ting > ; stable@dpdk.org; Yang, Qiming > ; Zhang, Qi Z > Subject: [PATCH] net/ice: fix raw flow input pattern value change in FDIR >=20 > When parsing raw flow pattern in FDIR, the input parameter spec and > mask are used directly and the original value will be changed. It > will cause error if these values are used in other functions. In this > patch, temporary variables are created to store the spec and mask. >=20 > Fixes: 25be39cc1760 ("net/ice: enable protocol agnostic flow offloading > in FDIR") >=20 > Cc: stable@dpdk.org >=20 > Signed-off-by: Ting Xu > --- > drivers/net/ice/ice_fdir_filter.c | 25 +++++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_fdir_filter.c > b/drivers/net/ice/ice_fdir_filter.c > index 7954c6d8ea..6e3851a71b 100644 > --- a/drivers/net/ice/ice_fdir_filter.c > +++ b/drivers/net/ice/ice_fdir_filter.c > @@ -1868,14 +1868,15 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > break; >=20 > /* convert raw spec & mask from byte string to > int */ > - unsigned char *tmp_spec =3D > + unsigned char *spec_pattern =3D > (uint8_t *)(uintptr_t)raw_spec->pattern; > - unsigned char *tmp_mask =3D > + unsigned char *mask_pattern =3D > (uint8_t *)(uintptr_t)raw_mask->pattern; > uint16_t udp_port =3D 0; > uint16_t tmp_val =3D 0; > uint8_t pkt_len =3D 0; > uint8_t tmp =3D 0; > + uint8_t *tmp_spec, *tmp_mask; It would be better to shift this line of code UP four lines, to match the c= oding style. The rest looks good on me. Thanks! > int i, j; >=20 > pkt_len =3D strlen((char *)(uintptr_t)raw_spec- > >pattern); > @@ -1883,8 +1884,18 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > pkt_len) > return -rte_errno; >=20 > + tmp_spec =3D rte_zmalloc(NULL, pkt_len / 2, 0); > + if (!tmp_spec) > + return -rte_errno; > + > + tmp_mask =3D rte_zmalloc(NULL, pkt_len / 2, 0); > + if (!tmp_mask) { > + rte_free(tmp_spec); > + return -rte_errno; > + } > + > for (i =3D 0, j =3D 0; i < pkt_len; i +=3D 2, j++) { > - tmp =3D tmp_spec[i]; > + tmp =3D spec_pattern[i]; > if (tmp >=3D 'a' && tmp <=3D 'f') > tmp_val =3D tmp - 'a' + 10; > if (tmp >=3D 'A' && tmp <=3D 'F') > @@ -1893,7 +1904,7 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > tmp_val =3D tmp - '0'; >=20 > tmp_val *=3D 16; > - tmp =3D tmp_spec[i + 1]; > + tmp =3D spec_pattern[i + 1]; > if (tmp >=3D 'a' && tmp <=3D 'f') > tmp_spec[j] =3D tmp_val + tmp - 'a' > + 10; > if (tmp >=3D 'A' && tmp <=3D 'F') > @@ -1901,7 +1912,7 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > if (tmp >=3D '0' && tmp <=3D '9') > tmp_spec[j] =3D tmp_val + tmp - '0'; >=20 > - tmp =3D tmp_mask[i]; > + tmp =3D mask_pattern[i]; > if (tmp >=3D 'a' && tmp <=3D 'f') > tmp_val =3D tmp - 'a' + 10; > if (tmp >=3D 'A' && tmp <=3D 'F') > @@ -1910,7 +1921,7 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > tmp_val =3D tmp - '0'; >=20 > tmp_val *=3D 16; > - tmp =3D tmp_mask[i + 1]; > + tmp =3D mask_pattern[i + 1]; > if (tmp >=3D 'a' && tmp <=3D 'f') > tmp_mask[j] =3D tmp_val + tmp - > 'a' + 10; > if (tmp >=3D 'A' && tmp <=3D 'F') > @@ -1953,6 +1964,8 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, >=20 > filter->parser_ena =3D true; >=20 > + rte_free(tmp_spec); > + rte_free(tmp_mask); > break; > } >=20 > -- > 2.17.1