From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-eopbgr780083.outbound.protection.outlook.com [40.107.78.83]) by dpdk.org (Postfix) with ESMTP id 7ECE2548B for ; Sun, 11 Nov 2018 16:24:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T0qjmo6gFkbmiWjAIh/i3bNH6iHag6bHGzzBwKqbYUo=; b=TOAAtBaSuCQhVShNLju9HOF1Cwq4JR/fo9G9SbT9BeNhvPIwp6v0lSH5MOyz8q2yJsY5WeugcO2tv1BuH0e9U++svNWRTMjfuIOXMZQnnuwwc6oNuO50cwjXTdmwslAmp+IV+m7q+iJPm2AvGy57IRxs+KaxNlpNplpE0OgFzys= Received: from SN6PR07MB4911.namprd07.prod.outlook.com (52.135.77.157) by SN6PR07MB4846.namprd07.prod.outlook.com (52.135.73.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Sun, 11 Nov 2018 15:24:36 +0000 Received: from SN6PR07MB4911.namprd07.prod.outlook.com ([fe80::cd76:e8cc:c0:ebf4]) by SN6PR07MB4911.namprd07.prod.outlook.com ([fe80::cd76:e8cc:c0:ebf4%3]) with mapi id 15.20.1294.044; Sun, 11 Nov 2018 15:24:36 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara CC: "Joseph, Anoob" , "Jacob, Jerin" , "Athreya, Narayana Prasad" , "Dwivedi, Ankur" , "dev@dpdk.org" Thread-Topic: [PATCH 1/3] crypto/octeontx: fix non null terminated string Thread-Index: AQHUedKnrFHRvyhlrUCnS7PKzLOBzQ== Date: Sun, 11 Nov 2018 15:24:36 +0000 Message-ID: <1541949837-9629-2-git-send-email-anoob.joseph@caviumnetworks.com> References: <1541949837-9629-1-git-send-email-anoob.joseph@caviumnetworks.com> In-Reply-To: <1541949837-9629-1-git-send-email-anoob.joseph@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [115.113.156.2] x-clientproxiedby: BM1PR0101CA0039.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::25) To SN6PR07MB4911.namprd07.prod.outlook.com (2603:10b6:805:3c::29) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; SN6PR07MB4846; 6:elZLPgWQvZYe4Obe6+ypzvAT2zz24Yw8Zuo8x1OSZb0WOjViUx+AoIfd0XOiNhzghDqtZd4VAkzyt0qmmuKLEDXe90deI1geGev0bmGdTblxev20I15ooBAUH7P5kEmmaXt/rad+blvVsSqPAQLLXOoovt/0e5PXXR6upkXvSt+ZSqy2nC+ROD9lhJM3eXYcDkwmANeECbGiv9DUa2gxZuO7CFsODFJ9CHcLetzNsoU7VIdOwQGT/pwAbjQXG674P15kekK0gGN87n0CGV+zGhumj8upvCNL4FXrOZUn0ZwFME+uUu6FEJGh31fmFmSNsfz65MLi84oQY7GWIvIZiz1rDOPLUT+pULXZWggfb0/OOUecnWCxysh/BtZWtQPkl9RY0ChE3dsjSrcAeF1zVfuQQF4KaAeRcCKCnpT5pD0YTOY9Fo5K3lVoeyFyJiON0roSSRpnxayXjmm6xaLzVw==; 5:sajbvqb8dv+/FOazB+XDkVieZDxdPJzCjxU7/4H7HpasMnSvPAd3NCRyAIuNTZVDo9lfArTbrVBwZ2rt3jZXsfxxXDN+jr2XGLWOGD6gF/hYBxqYbkND4RlR1Dk9iWUEMrXSlcqAL6r8WlFWwBEcwC/XTCIQ0kOPcyqFdFtfaxE=; 7:jDDTIdALvDFTR68FFHtM93bxfq2XfUwyOHV5fhhTGAWPsC8YQj0O6iIvRiolBgH5F4q7MuyyV4n5N+KPFm+P0fm4l5cwiacolkuyIDbMyZsL4JUQskX+5nE/95IpqGIOBG97hs3wqZ949RselxWu9Q== x-ms-office365-filtering-correlation-id: 58dc86ce-db07-4dff-79f1-08d647e9c9ae x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4846; x-ms-traffictypediagnostic: SN6PR07MB4846: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231402)(944501410)(52105112)(10201501046)(3002001)(93006095)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:SN6PR07MB4846; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4846; x-forefront-prvs: 08534B37A7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(39850400004)(366004)(376002)(396003)(199004)(189003)(478600001)(6486002)(11346002)(446003)(2616005)(486006)(4326008)(476003)(66066001)(105586002)(5660300001)(6436002)(106356001)(68736007)(305945005)(2900100001)(7736002)(26005)(76176011)(42882007)(52116002)(14454004)(72206003)(25786009)(99286004)(97736004)(316002)(256004)(14444005)(71190400001)(110136005)(6116002)(54906003)(6512007)(53936002)(8936002)(81156014)(2906002)(3846002)(386003)(186003)(102836004)(6506007)(55236004)(8676002)(71200400001)(81166006)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4846; H:SN6PR07MB4911.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: XwgP5ACs2dGwLGwSJsCUcGktndTlwZ9DB03Lfj5rcCUyjkZk9o/tdMSZP17NkdvY9rhwrG0pWyydXpao32CjfMY9VAS/H2FgpEfo6RW0urBOZBrRL/mo5hOjy3oyla2mnxCYSCchgIMB6OERnIdbRflJwe2eMzDjLJvfQXRD58goodFfUZrj4/L+ZibvW7hD9UVrpetKFsNCE2/FSdpyQT5nq8hvSsm3lNHRxWYvrOn4KLAZ4nEMgPxEdZcy4jXyoOyXiD2BbSfGULu6UarBSpAd/Fmsk09ieLt9bGtOJMgpaF9FHX6xFZVgz1TyE9JhbY2KTZ4jg3Q+2YOH3eJ7qRNq+9522eVL+SFb3bsw4tw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58dc86ce-db07-4dff-79f1-08d647e9c9ae X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2018 15:24:36.0714 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4846 Subject: [dpdk-dev] [PATCH 1/3] crypto/octeontx: fix non null terminated string 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, 11 Nov 2018 15:24:38 -0000 If the length of string pointed by 'name' is equal to or greater than the sizeof cptvf->dev_name string, the resultant string will not be null terminated. Using strlcpy would make sure the string would always be null terminated. Fixes: 0dc1cffa4d33 ("crypto/octeontx: add hardware init routine") Signed-off-by: Ankur Dwivedi Signed-off-by: Anoob Joseph --- drivers/crypto/octeontx/otx_cryptodev_hw_access.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c b/drivers/cr= ypto/octeontx/otx_cryptodev_hw_access.c index 5e705a8..18f2e6b 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c +++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.c @@ -9,6 +9,7 @@ #include #include #include +#include =20 #include "otx_cryptodev_hw_access.h" #include "otx_cryptodev_mbox.h" @@ -366,7 +367,9 @@ otx_cpt_hw_init(struct cpt_vf *cptvf, void *pdev, void = *reg_base, char *name) =20 /* Bar0 base address */ cptvf->reg_base =3D reg_base; - strncpy(cptvf->dev_name, name, 32); + + /* Save device name */ + strlcpy(cptvf->dev_name, name, (sizeof(cptvf->dev_name))); =20 cptvf->pdev =3D pdev; =20 --=20 2.7.4