From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id EEF581B477 for ; Sun, 13 Jan 2019 20:28:51 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2019 11:28:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,474,1539673200"; d="scan'208";a="137905966" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 13 Jan 2019 11:28:50 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 13 Jan 2019 11:28:50 -0800 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.160]) by FMSMSX126.amr.corp.intel.com ([169.254.1.70]) with mapi id 14.03.0415.000; Sun, 13 Jan 2019 11:28:49 -0800 From: "Wiles, Keith" To: Nithin Kumar Dabilpuram CC: Thomas Monjalon , "Yigit, Ferruh" , Andrew Rybchenko , "dev@dpdk.org" , Jerin Jacob Kollanukkaran Thread-Topic: [dpdk-dev] [PATCH v2] ethdev: report error on name truncation Thread-Index: AQHUq1YRrlIJ7r+7kUSSCn3crITtCaWuG9kA Date: Sun, 13 Jan 2019 19:28:49 +0000 Message-ID: <0D9DB313-B5F8-4AD0-871F-CEECC49B4359@intel.com> References: <20190107143951.30076-1-ndabilpuram@marvell.com> <20190113153749.3540-1-ndabilpuram@marvell.com> In-Reply-To: <20190113153749.3540-1-ndabilpuram@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.183.40] Content-Type: text/plain; charset="us-ascii" Content-ID: <5D5C9606D94B1E49894BD58C48F3C8EE@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] ethdev: report error on name truncation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jan 2019 19:28:52 -0000 > On Jan 13, 2019, at 9:38 AM, Nithin Kumar Dabilpuram wrote: >=20 > Currently this api doesn't report error if name is > truncated and so user is not sure about uniqueness > of name. This change reports error to help user. >=20 > Signed-off-by: Nithin Dabilpuram > --- >=20 > v2: > Fix issue caused by rebase and also fix log message >=20 > lib/librte_ethdev/rte_ethdev.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 9d5107d..47d4f4a 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -3588,9 +3588,16 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev = *dev, const char *ring_name, > { > char z_name[RTE_MEMZONE_NAMESIZE]; > const struct rte_memzone *mz; > + int rc; >=20 > - snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", > - dev->data->port_id, queue_id, ring_name); > + rc =3D snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", > + dev->data->port_id, queue_id, ring_name); > + > + if (rc >=3D RTE_MEMZONE_NAMESIZE) { > + RTE_ETHDEV_LOG(ERR, "truncated name"); > + rte_errno =3D ENAMETOOLONG; > + return NULL; > + } I we are already returning an error here should the RTE_LOG be DEBUG and no= t ERR. Of course this does mean we would have to check return codes :-) >=20 > mz =3D rte_memzone_lookup(z_name); > if (mz) > --=20 > 2.8.4 >=20 Regards, Keith