From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ABFB3A0524; Tue, 25 Feb 2020 10:46:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5BABE1BFCE; Tue, 25 Feb 2020 10:46:56 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1F6A61BFCD for ; Tue, 25 Feb 2020 10:46:55 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01P9foVO030745; Tue, 25 Feb 2020 01:46:54 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=zFcxm+zk+p4RgAeFb8nBmCfjUGQT8HKn7RP8k0v7nPY=; b=Wtl1B5Ybk1aOEf7NruXFHH1Q4EAPby0J8/asE/5ooeyJ9spDugS9siOQUw91qxbiTBj/ jJDSKs9vUm23f/5HbJlf7Qkwb3S2jbcvj+Tea4+IXU/dJYEiscNz8YiRjpgMAR1wiAWF JeKHsmSGCxd+WGlHGF6Z3zYrWiXHhxTSp44QlzvPrECTSOyj5hm6UBtQWTStY/8t2AoD 32M0xBLewy4RKBe4sILkCBzH4gHRtFhj9yqt1knvt59jhND06xA8rbZuG/4tamzxgHgL klzeYd/OeGr93kaaNYspSmt8qoLCxIdeMAT7Dac5hHLlAl/EGXnFTpbYzsnZt4dlJ2Vp BQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2yb4ptavrd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 25 Feb 2020 01:46:54 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 Feb 2020 01:46:52 -0800 Received: from hyd1399.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 Feb 2020 01:46:49 -0800 From: Nagadheeraj Rottela To: , CC: , , Nagadheeraj Rottela Date: Tue, 25 Feb 2020 15:16:42 +0530 Message-ID: <20200225094642.29239-2-rnagadheeraj@marvell.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200225094642.29239-1-rnagadheeraj@marvell.com> References: <20200220110431.30074-1-rnagadheeraj@marvell.com> <20200225094642.29239-1-rnagadheeraj@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-25_02:2020-02-21, 2020-02-25 signatures=0 Subject: [dpdk-dev] [PATCH v2 2/2] crypto/nitrox: fix array out of bounds access 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In nitrox_sym_pmd_create() the name array will overflow if the pci device name is greater than 57 bytes. To fix this issue subtract pci device name length from array length while appending substring to the name. Coverity issue: 349926 Fixes: 9fdef0cc2385 ("crypto/nitrox: create symmetric cryptodev") Signed-off-by: Nagadheeraj Rottela --- drivers/crypto/nitrox/nitrox_sym.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c index 56410c44d..d1b32fec9 100644 --- a/drivers/crypto/nitrox/nitrox_sym.c +++ b/drivers/crypto/nitrox/nitrox_sym.c @@ -683,7 +683,8 @@ nitrox_sym_pmd_create(struct nitrox_device *ndev) struct rte_cryptodev *cdev; rte_pci_device_name(&ndev->pdev->addr, name, sizeof(name)); - snprintf(name + strlen(name), RTE_CRYPTODEV_NAME_MAX_LEN, "_n5sym"); + snprintf(name + strlen(name), RTE_CRYPTODEV_NAME_MAX_LEN - strlen(name), + "_n5sym"); ndev->rte_sym_dev.driver = &nitrox_rte_sym_drv; ndev->rte_sym_dev.numa_node = ndev->pdev->device.numa_node; ndev->rte_sym_dev.devargs = NULL; -- 2.13.6