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 7ABD1A0547; Wed, 21 Apr 2021 05:31:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CD60418DB; Wed, 21 Apr 2021 05:31:22 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 40A5A418AA for ; Wed, 21 Apr 2021 05:31:20 +0200 (CEST) IronPort-SDR: dwi1e/BrKKRa0LqSrtvVIxHQABtGcjk4tVXbN7Tv9ahAg4yA6YRyR4jqaDwX6o3I2F//8u1Lhs 4HUtFQGuHHWA== X-IronPort-AV: E=McAfee;i="6200,9189,9960"; a="175118218" X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="175118218" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 20:31:19 -0700 IronPort-SDR: I0SQoCEphdQRxKBTLN68OUnMS14LqM5L0nW6A/jJcnTG1MO9ZllTB8Lw/qAsNxrVbsIGaXlzoj +CnHG3RB3pZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="617210451" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga005.fm.intel.com with ESMTP; 20 Apr 2021 20:31:19 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 20 Apr 2021 20:31:18 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 20 Apr 2021 20:31:18 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 20 Apr 2021 20:31:18 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) 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.2106.2; Tue, 20 Apr 2021 20:31:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aFErcLQivSuwWrrxbYEL3iFFUzjl0G4/1tlZBaifzIg5kP4TpcOpwUn9M6Q0GdgOjCokN6wiul0pQKbGkjXuKfE5S7YmYq3ow5PBwLMEOtES1T8VzeGaMaxRGptzvzXdWXpkjhhLQmF0Q16dqPrZfyDvZ/XECy1bZEyNx3p679EBf7YQ8pyPbdVFlvLSUKG9vOhRcXbGqotj9LP/rbl2bry8+a6bkTmQWw5f97ilzC+gTchCBv5XnqmhhUs+6280UoAQDGrVsiE4QirITdXo+RFiTVDTgIXjbO3gXyjk/d49K1Q8fVktERswas+FCvB4V+/LnpWLnOKZCD78und+cw== 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-SenderADCheck; bh=uTlPBuyU2Pao+49HeP3V6tBLEkLUEPO2vFV6wiIePUc=; b=Hr1CHe9jSzX/JvgR6Lc8BTXOIiRf4UzQ7cPo5Y0063RuBFP31Y+1YX1Y6ASpkXsHDxqxFuxwHnT7NJcnZOML9JHd958C3Rl/LjwAvpF6nDj9DmJYziPKmOcyQtcZSayTLMdn8dk2t+ilXJPwtAd4UXJxHJ3Kd4eMdtwmyiMi5HqJFZ+XXL6FGIAy/BofEQ3CqDaGgdShTOqQAfbYC6/mZJHlBs9ajdym9NhOA4TMStxEscFocKiahQt52eyzXPGzGHn3lPGdkPqmGWofx9v0fgSWZQL5pRuTqbJZudpoe7GadyMYFd/UAGKsQprVpProTqUmnGd0OdqgMmJUx56Rzw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uTlPBuyU2Pao+49HeP3V6tBLEkLUEPO2vFV6wiIePUc=; b=uSsvJYK2msMpBFb33lpf6CYZIrhJd931kQtl2wWvW6/qJZoCiOSurQpYpPF6T8wHixcZeOiB8Bqz4dTbdccjnd5K3x2Ot0soCptaCOGaWuEGPDb/c4jehlHI2N11zc9O2UOmdxm3VmOS73UQVmJdYoqkNiKY3KYZG6XzC6iheKo= Received: from CH0PR11MB5523.namprd11.prod.outlook.com (2603:10b6:610:d6::15) by CH2PR11MB4391.namprd11.prod.outlook.com (2603:10b6:610:3b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.18; Wed, 21 Apr 2021 03:31:15 +0000 Received: from CH0PR11MB5523.namprd11.prod.outlook.com ([fe80::b1fa:6c6b:1a23:5411]) by CH0PR11MB5523.namprd11.prod.outlook.com ([fe80::b1fa:6c6b:1a23:5411%4]) with mapi id 15.20.4065.020; Wed, 21 Apr 2021 03:31:14 +0000 From: "Li, Xiaoyun" To: "Min Hu (Connor)" , "dev@dpdk.org" CC: "Yigit, Ferruh" , "Wu, Jingjing" Thread-Topic: [PATCH 1/2] raw/ntb: check spad user index Thread-Index: AQHXNlM1yphyrhWkEkWLNDd8WVGsa6q+UClQ Date: Wed, 21 Apr 2021 03:31:14 +0000 Message-ID: References: <1618970896-37852-1-git-send-email-humin29@huawei.com> <1618970896-37852-2-git-send-email-humin29@huawei.com> In-Reply-To: <1618970896-37852-2-git-send-email-humin29@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3139d21e-c83b-455d-aaab-08d90475eafd x-ms-traffictypediagnostic: CH2PR11MB4391: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:267; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: f6rLCEIZ9R5Ere5v+xPAbV1427kjZubRxkrpl5D/aOIb4OVEoPNWk3qEESTc8wmthkAvNQwZ3Y093GJJeVMB0e5+qm3iWdSCFB3bncyrX0OrN2gvTe/rFKOTWZPWQjzj9D6OcnmqGfSuK0d6t4K2nzXR20zGCJAsiswyX7FD+yGG4pqkIiVbXRsOmuxILwAqCroBYnBJuHAVAWz5yiOfJCPpsdU4BFnJtPNuqqQnHj5FTfFs6mUV7yETC1XB7VcStMwLdepKLbSu4JuHr+wp7g4BfLSzMm7WoM0NgTzaE1iebyOOd8OzPT+qxJ4stqa4kPRqNVAAOzfbyXFtyTPO/WT/nkHf5/idFEVjIXRTx+xugQexTIofm14XMJctOusEE21lKUNiYICu5G+uF5ijE59h5Ithz1sN738rihUEZaKl8gZAiNc7Cd5hd17HU5QtRsLKJcA/K9sOLyOxydQCuQ0lKJnfjBTDWK49mUy5J3XkLxOQRGB+w4XDPHF+Orqup56CPi+yZmd3d5Rib8ZHLYzftxPzgEAGXEKEj7lI3vAR4qj2DI0fnaeL7tIFN3Wtx+8yYFlm/3IgBOaBchn1aq8jk+OtUzfrOzpyEj7++Ow= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR11MB5523.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(396003)(376002)(346002)(366004)(39860400002)(66476007)(38100700002)(83380400001)(55016002)(9686003)(316002)(66556008)(52536014)(66446008)(64756008)(8936002)(71200400001)(66946007)(76116006)(122000001)(2906002)(110136005)(33656002)(54906003)(8676002)(4326008)(107886003)(26005)(6506007)(53546011)(478600001)(186003)(7696005)(86362001)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?LwyOSzxVdgPyObU7sw1r0Chyd47fO0SKpLrfosx99dXQzNaBB96T8LJpRyxD?= =?us-ascii?Q?4nRZlUG6f0yOrZCfUpiYw9Gw7iHO7L72x55fnaT3prq2JbLZMhECNm23VoBf?= =?us-ascii?Q?AJZsH9I0hT3K/3zeRXisry3mfRBTg7OSYJ5P9wex9l4PHPXjiOPo/dlt4h7k?= =?us-ascii?Q?Z5UAtWtR+3yDK6e4YP7HR1OFFM1+oVIdJSw6erSPqAy9orThavvGBoeFl7Ob?= =?us-ascii?Q?rFPSRmIhHBKUiK9LxDkCkWNZgZCl6ohbon6qQ/Gfb+Y8Lz3/mzLJssVI3Z/L?= =?us-ascii?Q?lhgyoo12Wen44gK45IECTEVKiDGXASHUEYrGrBGMdAupNRSw5TABcY0ojZll?= =?us-ascii?Q?2puYfz9LH6j4GMGaFFcrCxXui4Cwd6L2KhF/mIS40zf6jSlVx92Hq8RNWm4Z?= =?us-ascii?Q?sPAL+CzNaMXBvuVwXYBpR4aGtHRADcRTraOHgIUknc6PtpXQRFV0VAs+pN1r?= =?us-ascii?Q?2SKr5mSMaVsnv4OcOrGqNDifSp6lOYS7jCmq+TTY0f1EzScII17lAwcr3yzu?= =?us-ascii?Q?kH9DEGaz1yzZqHg5+0Wc6DBY1Ffb/6Fxzjg71NcUYVDowVWGbRpty/I6HHth?= =?us-ascii?Q?isyuAHZMZGhCI/Y2bv2B6F/S6cPIk9NgTIteN7GqPhSwm3Dka4unrkX6rRsy?= =?us-ascii?Q?dEEsP/XcjiQeXpX8FanyGDhXSfE0mG4MVBYd1N1utBk0bB34g+S8lElFQxMw?= =?us-ascii?Q?FVB5dSUPenSG0sDF3+6KrB7m/Hm4zzfv1CMROxKVOOxfmtWYHX6liwXWiXB3?= =?us-ascii?Q?d+HzP5QZnVNiLef78Tw52E+kTxsKRi1E+e65F9VP6FFBiFClc55I5KedruFq?= =?us-ascii?Q?WKLh1KLwUQEwHOiQrnpDrne//9+Mh5yL1Fvka8LhgbNRSEnzGWCo9TaQPrkO?= =?us-ascii?Q?jbzzX54i1o+XJ8toQEIuKnvgype7y64zMIn2ZbVALwAQKTHpvOzrB6+t71ho?= =?us-ascii?Q?o/AOLYyIcbfCIfHj6549Qh0G0GHEsECxO8UpMh+I+eF+bNQ/Cq88GwQrH7Qf?= =?us-ascii?Q?4wYD0XJFxbpZGVpsqm2FftyJnnU+QO2bEN8FmpHfMJur5fk4vpmi3/PvEQCj?= =?us-ascii?Q?P6Dwk7vYES/02BWjv5znuJApA9V6f1jHHDS/IC5Y8XMoVzhHKc/NzuGNkMt9?= =?us-ascii?Q?x2jsjjXYC4VApHPI2l88SnT8A6j31qawXJLVnObp1BIWfnbHiGVc1YXj9zz4?= =?us-ascii?Q?bIlxulGQnRxYz+EHNxzJ85IFibH1apsdayI1eOeyfEbrZAzoiRLru2s5ZVRg?= =?us-ascii?Q?ijwJOqDHMVT3Z+ywPHpisvYEMOVpLGZFPgtRynbve08j2pzATxnH54JdAZ6V?= =?us-ascii?Q?QC8=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: CH0PR11MB5523.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3139d21e-c83b-455d-aaab-08d90475eafd X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Apr 2021 03:31:14.8638 (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: uy/yrLgVIJBtM6n2IfmbALin+PdSU2Wzr3BG/a0z4C4tmzJNddTP904SLj1bZzl/1txm5EzozuSnySNn+UH77A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR11MB4391 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 1/2] raw/ntb: check spad user index 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 Sender: "dev" Hi > -----Original Message----- > From: Min Hu (Connor) > Sent: Wednesday, April 21, 2021 10:08 > To: dev@dpdk.org > Cc: Yigit, Ferruh ; Li, Xiaoyun ; > Wu, Jingjing > Subject: [PATCH 1/2] raw/ntb: check spad user index >=20 > From: Chengwen Feng >=20 > This patch adds checking spad user index validity when set or get attr. >=20 > Fixes: 277310027965 ("raw/ntb: introduce NTB raw device driver") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chengwen Feng > Signed-off-by: Min Hu (Connor) > --- > drivers/raw/ntb/ntb.c | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c index > 6dd213e..0f0e3f2 100644 > --- a/drivers/raw/ntb/ntb.c > +++ b/drivers/raw/ntb/ntb.c > @@ -1080,6 +1080,10 @@ ntb_attr_set(struct rte_rawdev *dev, const char > *attr_name, > if (hw->ntb_ops->spad_write =3D=3D NULL) > return -ENOTSUP; > index =3D atoi(&attr_name[NTB_SPAD_USER_LEN]); > + if (index < 0 || index >=3D NTB_SPAD_USER_MAX_NUM) { > + NTB_LOG(ERR, "Invalid attribute (%s)", attr_name); > + return -EINVAL; > + } It's unnecessary. The value will be checked in intel_ntb_spad_write(). Ther= e will be error remind in that. > (*hw->ntb_ops->spad_write)(dev, hw->spad_user_list[index], > 1, attr_value); > NTB_LOG(DEBUG, "Set attribute (%s) Value (%" PRIu64 ")", @@ > -1174,6 +1178,10 @@ ntb_attr_get(struct rte_rawdev *dev, const char > *attr_name, > if (hw->ntb_ops->spad_read =3D=3D NULL) > return -ENOTSUP; > index =3D atoi(&attr_name[NTB_SPAD_USER_LEN]); > + if (index < 0 || index >=3D NTB_SPAD_USER_MAX_NUM) { > + NTB_LOG(ERR, "Attribute (%s) out of range", > attr_name); > + return -EINVAL; > + } Same as above. > *attr_value =3D (*hw->ntb_ops->spad_read)(dev, > hw->spad_user_list[index], 0); > NTB_LOG(DEBUG, "Attribute (%s) Value (%" PRIu64 ")", > -- > 2.7.4