From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pablo.de.lara.guarch@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 626821B2A2;
 Fri, 26 Jan 2018 15:44:30 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 26 Jan 2018 06:44:28 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.46,416,1511856000"; d="scan'208";a="13354083"
Received: from silpixa00399464.ir.intel.com (HELO
 silpixa00399464.ger.corp.intel.com) ([10.237.222.157])
 by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2018 06:44:27 -0800
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: roy.fan.zhang@intel.com
Cc: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>,
 stable@dpdk.org
Date: Fri, 26 Jan 2018 14:44:28 +0000
Message-Id: <20180126144428.13154-1-pablo.de.lara.guarch@intel.com>
X-Mailer: git-send-email 2.14.3
Subject: [dpdk-stable] [PATCH] crypto/scheduler: fix strncpy length
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Jan 2018 14:44:31 -0000

The coverity issue was not completely fixed, since strncpy
should be called with max length - 1.

Coverity issue: 143431
Fixes: d040aca67170 ("crypto/scheduler: fix strings not null terminated")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index ccf68a0ee..726f68281 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -440,7 +440,7 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id,
 		return -EINVAL;
 	}
 	strncpy(sched_ctx->name, scheduler->name,
-			RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
+			RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN - 1);
 
 	if (strlen(scheduler->description) >
 			RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN - 1) {
@@ -450,7 +450,7 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id,
 		return -EINVAL;
 	}
 	strncpy(sched_ctx->description, scheduler->description,
-			RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN);
+			RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN - 1);
 
 	/* load scheduler instance operations functions */
 	sched_ctx->ops.config_queue_pair = scheduler->ops->config_queue_pair;
-- 
2.14.3