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 EE4061B3FB for ; Mon, 7 Jan 2019 15:40:09 +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 x07EZAor027749; Mon, 7 Jan 2019 06:40:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=A6pipGKWxWIU/w59AHEKakfqAQdYbS0OXQRK6hAo8Vg=; b=TrwNn+iy34czYf1c/2lVvdjuRVR3UF0kp2n0r1bPanTYeA+C3cvgnVTc67e5EqCtiAMu voMZsUPVGegEj2qKA1Xuk2jwnR4mDQN+elyW3rY47Vq08JG6/MkusqS8kzgEik/FxFOr kB3DTlYYhMszE0QLVsd/KtAmJj46cFFM7+WFqa7nSu5aC4eUZb95EBaN+/gTIYP+1QSc 0wxaFGdEg9MZlQLv10+fLMomZ0GDlhwQjbv82LKsWUvjgBQ7I66HrTkENp6SB9TP6riP gTA5CrMFn68YEsmpjI1JoVHfo5/ip/mntAM/sH5gK2IxoQwPGIgGM+3kKsrsutE/vv1S DA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2pv58srqp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 07 Jan 2019 06:40:09 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 06:40:07 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.52) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 7 Jan 2019 06:40:07 -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=A6pipGKWxWIU/w59AHEKakfqAQdYbS0OXQRK6hAo8Vg=; b=WJRcK24vOsm1VT1D2MfRGTz/fky/SymqO+QsImmEVBfOxwdcumRQSIiNdgDrxa3lW4SCMRQ5oLXaXsjl4EbY/LXyQZ7LnJOw+9aP7zRwve6dxAoLLVqXJUnvTWfPMMi0Kc+MXIbqai1e1mXYuVhl4xX96LOdtOxEJG6IruNwEJI= Received: from DM6PR18MB2427.namprd18.prod.outlook.com (20.179.104.21) by DM6PR18MB2395.namprd18.prod.outlook.com (20.179.71.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Mon, 7 Jan 2019 14:40:05 +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.1495.011; Mon, 7 Jan 2019 14:40:05 +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] ethdev: report error on name truncation Thread-Index: AQHUppbhtFOKYPOsVUWsd7vKUiZ53A== Date: Mon, 7 Jan 2019 14:40:05 +0000 Message-ID: <20190107143951.30076-1-ndabilpuram@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR01CA0100.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::16) 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; DM6PR18MB2395; 20:aTx/J98okcbLtDSiNJ4Z0Lxg6NcBpJU9BB3aGvS39P6fyiW7hwmroilNXFR4aKE3gIjU8EY46EEOJxiS5P2uG5Wc7k27RnW0TGyXq7PO0/n5mExzqi3g1jbIUJtCkZy5Gv6YeIybdsZs3j5TscMHek6faCjYDsJy0QFVdPYLQxU= x-ms-office365-filtering-correlation-id: 2bcd4020-ae07-45b9-78c2-08d674ae037f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR18MB2395; x-ms-traffictypediagnostic: DM6PR18MB2395: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231475)(944501520)(52105112)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:DM6PR18MB2395; BCL:0; PCL:0; RULEID:; SRVR:DM6PR18MB2395; x-forefront-prvs: 0910AAF391 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(136003)(396003)(366004)(376002)(199004)(189003)(52116002)(478600001)(2616005)(26005)(6436002)(6486002)(53936002)(107886003)(110136005)(54906003)(186003)(5660300001)(71190400001)(55236004)(68736007)(6506007)(386003)(81156014)(2906002)(81166006)(71200400001)(256004)(50226002)(97736004)(102836004)(99286004)(8676002)(486006)(106356001)(316002)(14454004)(86362001)(8936002)(6512007)(6116002)(66066001)(3846002)(4326008)(25786009)(1076003)(7736002)(36756003)(476003)(305945005)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR18MB2395; H:DM6PR18MB2427.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: oWebmE3U4dGBlAeuPi069w0Df+z7sgEirazBcTgY74z0ACwVv+CChewsuiMTD8THYhAYpTuqeVZYfGV4B3avt5vn0RRPAEcUvSPUgbrdNM1ha0+sGkDgum6QfjxJYoKEeAmNLPYbf9Zygur2fNUhsFc09v+P5QFSlpa8vwflaRYFmVLvrsfinOjakbw9E8VU1ENX2eVVxh4V6Zzt+4/Na31itlC7P3uqy4eJgWcq8Fovt9d+WotPbUNV/1benumUeGLmYAksc6tcN+7B+TCK5KplkGJskZM3tbEUQHD9w9YqkXy/t/BpnI44JOggkFSq 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: 2bcd4020-ae07-45b9-78c2-08d674ae037f X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2019 14:40:05.5774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR18MB2395 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-07_06:, , 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=1011 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-1901070129 Subject: [dpdk-dev] [PATCH] 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: Mon, 07 Jan 2019 14:40:10 -0000 Signed-off-by: Nithin Dabilpuram --- lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.= c index 9d5107d..bd45445 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3588,9 +3588,17 @@ 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), "%s_%s_%d_%d", + dev->device->driver->name, ring_name, + dev->data->port_id, queue_id); + + if (rc >=3D RTE_MEMZONE_NAMESIZE) { + RTE_LOG(ERR, EAL, "%s(): truncated name\n", __func__); + rte_errno =3D ENAMETOOLONG; + return NULL; + } =20 mz =3D rte_memzone_lookup(z_name); if (mz) --=20 2.8.4