From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 9A68B1B44B for ; Sun, 13 Jan 2019 16:38:19 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0DFYoTs006138; Sun, 13 Jan 2019 07:38:18 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=nVatm2ZWaZ+4Hm2Y8C4vJ57RTHJ6ex4Ge+r4uRZlyts=; b=rolXBnsuJjzSCQSXdqu5FFLEFJTubSxZuyr4gPPTgyC0hJ9rIjozV5SUYxeZwm5s+ake GFYnmHROjvEaHgC/9D7AMOMq00LXyWAUfBqH9ul0fbQAoaRm4O7+WVZSrkP1vH77r+an gdE9pRxa+1j+4i0Z6UpnnZ+euklGIPT4WCCtxRn5D8RSgQpWX10nkRDVEoLNO2Q6tVum acKubjyHI+qzewF8Sg1iT67UQZ3zy4q0C3NSDzzIy741BYSojK+tJ69TFTqDPtZOm+dG aaZBBASoZZZRm0JKqAAGWxQ82eHf35x8mbqQt3A4iaFpiSoCN6tXC4Ka19EuNreqW33B yg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2pygmktgua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 13 Jan 2019 07:38:18 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 13 Jan 2019 07:38:17 -0800 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.54) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sun, 13 Jan 2019 07:38:17 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nVatm2ZWaZ+4Hm2Y8C4vJ57RTHJ6ex4Ge+r4uRZlyts=; b=QZnWzNiUwG13H7C5zkVoYrtDgr7dGkOclQKGuZB7EZ1PPa586UdoSs3w3xbga9eIGGgHksTqq+uEm9qpuV5lR25LmM/L1oi9hqfklResG4IrKgatR+p8UMs/dWkQaFF6zHQoAK7PlZLoZPm7ZicaF4+W6/vKkeDq9rUFXRhXOxM= Received: from DM6PR18MB2427.namprd18.prod.outlook.com (20.179.104.21) by DM6PR18MB2892.namprd18.prod.outlook.com (20.179.52.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.20; Sun, 13 Jan 2019 15:38:15 +0000 Received: from DM6PR18MB2427.namprd18.prod.outlook.com ([fe80::11f0:6cac:aa5d:c1b7]) by DM6PR18MB2427.namprd18.prod.outlook.com ([fe80::11f0:6cac:aa5d:c1b7%3]) with mapi id 15.20.1516.019; Sun, 13 Jan 2019 15:38:15 +0000 From: Nithin Kumar Dabilpuram To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , Jerin Jacob Kollanukkaran , Nithin Kumar Dabilpuram Thread-Topic: [PATCH v2] ethdev: report error on name truncation Thread-Index: AQHUq1X/maI1m/QnwUenOHLuLhzcLw== Date: Sun, 13 Jan 2019 15:38:15 +0000 Message-ID: <20190113153749.3540-1-ndabilpuram@marvell.com> References: <20190107143951.30076-1-ndabilpuram@marvell.com> In-Reply-To: <20190107143951.30076-1-ndabilpuram@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0070.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::32) To DM6PR18MB2427.namprd18.prod.outlook.com (2603:10b6:5:180::21) x-mailer: git-send-email 2.8.4 x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM6PR18MB2892; 20:11ZDhrDtur8FbS2eFzbZE4CXSinKc13UxPw/cTyE1NFnDEqPi1zvgV4rpa5iQVvb7l1pirhAetoREwQssQ0QaW5WgL9n+LvrJLFQDJngi2/5sUzf+o8CvdYA67cDWswaonEC+hzWyHr7I/mLCqY9UHM2X1zRL1BFX5JyBZXLUyc= x-ms-office365-filtering-correlation-id: 4a9fbc28-b6ec-4454-e853-08d6796d21f8 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR18MB2892; x-ms-traffictypediagnostic: DM6PR18MB2892: x-microsoft-antispam-prvs: x-forefront-prvs: 0916FC3A18 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39850400004)(396003)(376002)(346002)(366004)(136003)(189003)(199004)(6486002)(86362001)(110136005)(4326008)(6436002)(97736004)(8676002)(54906003)(2616005)(316002)(11346002)(446003)(8936002)(14454004)(478600001)(476003)(486006)(81166006)(36756003)(81156014)(2906002)(50226002)(256004)(6116002)(106356001)(3846002)(66066001)(186003)(105586002)(6506007)(99286004)(7736002)(55236004)(26005)(305945005)(386003)(68736007)(5660300001)(25786009)(102836004)(6512007)(107886003)(53936002)(1076003)(76176011)(71200400001)(71190400001)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR18MB2892; H:DM6PR18MB2427.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: GrjY0ZNbb2pwnCoeNbEcQBZsxdwWYjX/pv6SsLJs6vTsrpw90jJwBJHcpfxIQ+w3kewyNk8RKm7PWXRzg8TluY9DSn91z4sBVYfuKhPxwBo+ZzG83smwrSMKmbKR8XGgtcfUPJj9ZpklKP9qWXFwyTYkX/uJ5rJhE9tfIcKXmQK7HDcG0Xj9wMi/+Yw9W9a8fxPOlf0Y8YMJdMqLBv3xLrWfmrmWkszIlL/F5zp3IiqKpoXk/qv0hBW2zDuGjs1y+ICfKjRV5IoWnX6X2osmkOVJHQ+iuT+EUXQlN/9fxnqrpAp99Ys7zt8Oze9992TuIzqxctXhF3mdKLuiVA+u5K1Kz+Vy6Mu5Q5i1qGVbY1hdyq36E059ONhj31ntQ3CLKoXNWRt55WfhnyRgUjgnZHmcH+6YlQ7hOSV1oUUW03Q= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4a9fbc28-b6ec-4454-e853-08d6796d21f8 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jan 2019 15:38:15.5455 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR18MB2892 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-13_08:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901130141 Subject: [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 15:38:19 -0000 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. Signed-off-by: Nithin Dabilpuram --- v2: Fix issue caused by rebase and also fix log message lib/librte_ethdev/rte_ethdev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.= 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 *d= ev, 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; + } =20 mz =3D rte_memzone_lookup(z_name); if (mz) --=20 2.8.4