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 5D5E2A0548; Thu, 22 Apr 2021 07:06:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2EA0D413FA; Thu, 22 Apr 2021 07:06:03 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 4FFA8413E6 for ; Thu, 22 Apr 2021 07:06:00 +0200 (CEST) IronPort-SDR: oMbdQ7TmkEqsDrTQQH9iICn0RAUZTZ88ZRcNE8s+wVGOPg8sNN1QgPa3zOA3FkEE1VMrm5ht5m T3ACystz5h4Q== X-IronPort-AV: E=McAfee;i="6200,9189,9961"; a="195855333" X-IronPort-AV: E=Sophos;i="5.82,241,1613462400"; d="scan'208";a="195855333" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 22:05:59 -0700 IronPort-SDR: At31kAgCoy4AkfJB4YaEvD3Y6wH27AwBjYIkKKHG2jxoCPGlty3HoEKRqK1Rgt1I6Dsy2ch7i2 cyzjXrLPWa3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,241,1613462400"; d="scan'208";a="603107487" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga005.jf.intel.com with ESMTP; 21 Apr 2021 22:05:58 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) 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; Wed, 21 Apr 2021 22:05:58 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Wed, 21 Apr 2021 22:05:58 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.174) 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; Wed, 21 Apr 2021 22:05:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UHxZ6jUcYdQLK6LSifYQ+Uvv2s2Lcrjj/uZNhVR65x3vmR3KEWeb08xispiD8VhjCm2zRCehlKvq8c9fVVUU44r7axZSP7mqSkyA7Om87/8R7BzTjcQtOQD2L0nFwg57E2P8vk/C1PNTbRNBOaXSW6PkSQaSTO+Zfb3txBkLfIMvniGCRZFy/PXz4/Ze+2IwfZ/BmIZ9PCFw4jl3/ioB94IoGXvHY+amy/73dbSShF3S6wx1/okkb60TJYLjHZGhrv3tBnlBJzUSfX/LimJQBgt35gjJGRMHAiUlv50JaMtiethJSJOa2LpXICKsvEDQ1Jp3F6OQE9sEq2jkx0R2zQ== 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=TzKGQq0xNovbkJY2vkf1O3zt0oeU5VBQR0PNQ38Y/P8=; b=bd6hDRhYQ3EIhmvo3sln5yXIv6ue6+3mUtlbkOkdf2XUVMOLSfl8Y1QYjNVrdTDkIqIbF24kabh+F4MMiwfvyOyswvs8JvvdBdfcc8ljFBue66+f9Uvtp4m4XZeqHkl1CTCt5YyjHmCCSnvLlMiXDtXcs/1yo6hviZ43xoxAzUad7JNfwkxj57+g03ZnJwW4Y/FTV5ex56WBP+k11nC5BvxgjjBk/nHS4dbGf8sDAjPIUpYIxIk7HmwhuY0bXGdkuWTv3/iCnMTXdb7KZW8i+T52wDmw9ni3ERksTSNcfv8vLEwsoUuUX/b6IPw5A8O0lZauuojGhmYV8rzzrgpSpA== 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=TzKGQq0xNovbkJY2vkf1O3zt0oeU5VBQR0PNQ38Y/P8=; b=HbOrc64NnYOUjb3OPdKKLSJviuACQMnZTsBMYq8ck6yHzk0s1zuMUlXUeEVqCeJUHkdDkDEG0gSOkzdieNCBbWbvngcIb/O98E+Uh3pywqKIbKYw5bUEBgw27TS3dHe6RRMy4ZhTnzCdfeI0tDbTMU54DSVnSoAa0frKmb5AS7M= Received: from CH0PR11MB5523.namprd11.prod.outlook.com (2603:10b6:610:d6::15) by CH2PR11MB4438.namprd11.prod.outlook.com (2603:10b6:610:4a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.21; Thu, 22 Apr 2021 05:05:55 +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; Thu, 22 Apr 2021 05:05:55 +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//Yew Date: Thu, 22 Apr 2021 05:05:54 +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: 24f79c52-ce12-4bee-e31e-08d9054c4f00 x-ms-traffictypediagnostic: CH2PR11MB4438: 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:82; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3FONCjdA9VKVE75gcqSfr/JvkQWFFVZbTVeSBIbt5T/WW0ZTw+COcBln2DEJi2VwCUZYISYLbQNCd+FqsOqM8adGV/H7esBxD0NY9KrKFGgmcov7CiNTeZrSh28getHOUiiQ4RmCqCcGB+LiVFB6oPnG+vzqD5lnDEW6YZ5pKOzZeRR2bwl+X2D87HjgHOsUrkGZkhmHJLdr3wlyaL4L9RmXJLgmDtIeCyQqqSzMt7fD4QuTSKdQ5OUmQcHCq94QrsVsv/EgvmsSpp8qabPYsNnWj0mV0fXpSrmnQV9PFZZfyT6OuPo81qSz9AXxFns2Ex79Ir64IRk42LL1UBXDDDjpsrKDeqa6oZClhyGZDEmEDe4j7QDPYGqGCYBjRr3k21jN76mFJ/hMFR2/bCDu0dHXCPlfHZKj5aNaVL0mx0g20A3+iGNNFucZYL6uakds1oYS/+Qq2B2f3LMnY81iQ1BibXtbwMqua6zaA4uOC3pW9quN6O41Eq5mLGGID1fA7PEm+YkIL6O0evpgdp+duC56FzeVNH5XxpWgFwCXqoTyX/O5AWTReswMgX1jwurDdCCeFsMMFb5yYYWw/WUMRbS5LuPCwIvOgEpjy/rgJa8= 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:(366004)(346002)(376002)(39860400002)(396003)(136003)(110136005)(83380400001)(2906002)(122000001)(54906003)(66946007)(4326008)(5660300002)(86362001)(8936002)(7696005)(71200400001)(26005)(38100700002)(66446008)(66556008)(66476007)(316002)(9686003)(478600001)(6506007)(64756008)(33656002)(76116006)(107886003)(52536014)(8676002)(53546011)(55016002)(186003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?peUXwezywLSY3L8Qdp7Ix2Ra5q+bTu79Yz1tO32wEGsMutSVd18M1G6mJFmc?= =?us-ascii?Q?IZfT7TORVtIaqWWP6XurcwVKafNmxae92Z0coQp0ydspDcvk1UncvMAietUO?= =?us-ascii?Q?V8wHFkf/Qi8cN8A2MiPoMSOMnoUx5sz54iEId7221w0rkU3YnI/EdSq9RCyo?= =?us-ascii?Q?+IJUpLcj5tvvDOSWGXtCGW0YNsnc6556XEZRFpCKqF0VfJ+ABWTUQWDVoGiV?= =?us-ascii?Q?sa5hg9A/EImBeIB1yv0cMJFPuVNdq6C6YIxVGQJPPd2/MhXSg3rGrUxWs2Gg?= =?us-ascii?Q?yHJt2DS9pU20qryZyIXZlz0ROJjAvxA7HfDgo19o1jz50Kth6G64fL9HuXte?= =?us-ascii?Q?6s+QgkW0Lq/9Jfky09iJKgQsW4+klLI1fCW2l/E0FU0hMLUnFlf/mM2KrfK0?= =?us-ascii?Q?dLMnB6SE/MogtI263S+LX7tj5xqylFmzo0pnNY98DpB+NEx8z2/Ac1gbMVNY?= =?us-ascii?Q?h1JaTnl4we8xAa0XTVmLky2JW/GA+G/Jlm73NGMwL0j0drTNUKQ1ocxWrych?= =?us-ascii?Q?KXYvMXDpcpLpPS/6FDYblcpTe+RTlhSire6rGFoS0BwZ9DqtnLKsrfpKCncg?= =?us-ascii?Q?9xvRZjUuGH5ovKa5kg/J3QuQTE+tC8G6zBgI5JxySkflX88LRvvReOYQPjIr?= =?us-ascii?Q?/KdQNlZk2fMhOLfbxWjZ8KMjN3bbWiAYZzjKCvCCw/qPy2tXVuAYjondvJxY?= =?us-ascii?Q?GGvkB6gYZTuc77KWM44/xa34CSDup5VGuMhBOPAiCcl0aGr1/S420HKdtYEB?= =?us-ascii?Q?WtcuOX9J1C8OvaktSDaIEA8Xo/9SKaJnX33HC7eqfILuZ/BuCqRegrojW1iR?= =?us-ascii?Q?i78J4A2nU+cFyJZCTViBC4ZDCyorw10UV5ZBeRaWCHNZHswOtXjnqb8fwRxH?= =?us-ascii?Q?YKWab2D2iWJzoQeVdI3dgUdKiZPdKIkJT2O3aENkndxWKMSgTvXEApv5MDjC?= =?us-ascii?Q?fAf4sEnvSXsddpTbZUPTnYUo+0v/0jFKD9ol1UqOCV6E7BquseZxqZ8bGqfF?= =?us-ascii?Q?t7iYmRTWEiqbahwwfmIVms11jCSmcD7wMPqODXtuUNzW+W1/vbaIitQJ6r4I?= =?us-ascii?Q?OMuoIo+MnSArvEJ+W3ngmI1iRhCQTeoDX3Ncr/ajFQrVYEW3lWIa+RkGQ4gp?= =?us-ascii?Q?cv2xOlLtIbIaiul4xDq1tZc9gDJNv55YLTM9dUFwLDmql+8FmBXqSQ3k8Mvs?= =?us-ascii?Q?vOnEtaC3OswEkXcflh/mqW2W3ftvQMezD3VLkti7Hdy5YjA/qwvYVGAqqOSi?= =?us-ascii?Q?eqKO7o9M0/6SgNFthQ9aSHn0wR+n4rAb3+wby1kM3O2uMky2KuUdFm+cFgfp?= =?us-ascii?Q?pWo=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: 24f79c52-ce12-4bee-e31e-08d9054c4f00 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2021 05:05:54.9811 (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: zmKC801ClNR83znAIpMHFYwEoTmhN3D6RXyt9xuvoUNYNhoaLKScjKHTFlLOtXsmzroBVZWT/je48bqLzM8/Og== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR11MB4438 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" > -----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; > + } > (*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; > + } > *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 Acked-by: Xiaoyun Li