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 BD710A057C; Fri, 27 Mar 2020 14:42:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 903E01C1DE; Fri, 27 Mar 2020 14:42:52 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 5A8351C1D6 for ; Fri, 27 Mar 2020 14:42:49 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02RDgmpQ018804; Fri, 27 Mar 2020 06:42:48 -0700 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=OShmuuXJdsVHuA6hTQZeIXKxraIyAh8vHPmaUfCVQLaEfol8AvXZDKUXIF2zoLBkQwBt IZFsvuUWv04gM5JCqAiYygm0V7M5fk90FqWO6B6NkiiKmUz42f5bpSswpzVt5JDBVkDt uXmcuf8bDvEl4aSc5QFFsjKYOjakbnYBahL8caxEmqadK0wZPmI2D1TF11sKGyxGHx4Z nGJPJkk9Q9IpHx4VS+QGRbQU2AVzYNpkRGMs6r9CGXG8lYmph4lyDz117cZuoAmtw7la U1HHlbtn9kgCXXLokVJnff9o3jEPCv249GflN8jjs2ufu434jmo5GJCMo6roj7Y/dxBO Iw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2ywg9p3053-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 27 Mar 2020 06:42:48 -0700 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; Fri, 27 Mar 2020 06:42:47 -0700 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; Fri, 27 Mar 2020 06:42:45 -0700 From: Nagadheeraj Rottela To: CC: , , , Nagadheeraj Rottela Date: Fri, 27 Mar 2020 19:12:39 +0530 Message-ID: <20200327134239.23358-2-rnagadheeraj@marvell.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200327134239.23358-1-rnagadheeraj@marvell.com> References: <20200327134239.23358-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.645 definitions=2020-03-27_04:2020-03-27, 2020-03-27 signatures=0 Subject: [dpdk-dev] [PATCH v3 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