This patch fixes the name parsing issue. Originally, the unique
scheduler name created by system is not passed to vdev
initializer.

Fixes: 8b483eae ("crypto/scheduler: register scheduler vdev driver")

Signed-off-by: Fan Zhang <roy.fan.zh...@intel.com>
---
 drivers/crypto/scheduler/scheduler_pmd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/scheduler/scheduler_pmd.c 
b/drivers/crypto/scheduler/scheduler_pmd.c
index 62418d0..eeafbe6 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -116,19 +116,22 @@ static int
 cryptodev_scheduler_create(const char *name,
        struct scheduler_init_params *init_params)
 {
-       char crypto_dev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
+       char crypto_dev_name[RTE_CRYPTODEV_NAME_MAX_LEN] = {0};
        struct rte_cryptodev *dev;
        struct scheduler_ctx *sched_ctx;
 
        if (init_params->def_p.name[0] == '\0') {
                int ret = rte_cryptodev_pmd_create_dev_name(
-                               init_params->def_p.name,
+                               crypto_dev_name,
                                RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
 
                if (ret < 0) {
                        CS_LOG_ERR("failed to create unique name");
                        return ret;
                }
+       } else {
+               strncpy(crypto_dev_name, init_params->def_p.name,
+                               RTE_CRYPTODEV_NAME_MAX_LEN - 1);
        }
 
        dev = rte_cryptodev_pmd_virtual_dev_init(crypto_dev_name,
-- 
2.7.4

Reply via email to