crypto: hisilicon - fix strncpy warning with strscpy

Use strscpy to fix the warning
warning: 'strncpy' specified bound 64 equals destination size

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Zhangfei Gao 2020-06-15 11:38:37 +08:00 committed by Herbert Xu
parent a05b1c150f
commit 6ec5e8b5e7
1 changed files with 5 additions and 1 deletions

View File

@ -2170,8 +2170,12 @@ static int qm_alloc_uacce(struct hisi_qm *qm)
.flags = UACCE_DEV_SVA,
.ops = &uacce_qm_ops,
};
int ret;
strncpy(interface.name, pdev->driver->name, sizeof(interface.name));
ret = strscpy(interface.name, pdev->driver->name,
sizeof(interface.name));
if (ret < 0)
return -ENAMETOOLONG;
uacce = uacce_alloc(&pdev->dev, &interface);
if (IS_ERR(uacce))