DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/scheduler: fix strncpy length
@ 2018-01-26 14:44 Pablo de Lara
  2018-01-26 14:49 ` Richardson, Bruce
  2018-01-29  9:22 ` [dpdk-dev] [PATCH v2] crypto/scheduler: fix strncpy Pablo de Lara
  0 siblings, 2 replies; 6+ messages in thread
From: Pablo de Lara @ 2018-01-26 14:44 UTC (permalink / raw)
  To: roy.fan.zhang; +Cc: dev, Pablo de Lara, stable

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-31 18:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 14:44 [dpdk-dev] [PATCH] crypto/scheduler: fix strncpy length Pablo de Lara
2018-01-26 14:49 ` Richardson, Bruce
2018-01-29  9:14   ` De Lara Guarch, Pablo
2018-01-29  9:22 ` [dpdk-dev] [PATCH v2] crypto/scheduler: fix strncpy Pablo de Lara
2018-01-30 12:17   ` Zhang, Roy Fan
2018-01-31 18:01     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).