diff options
author | Zhangfei Gao <zhangfei.gao@linaro.org> | 2020-06-15 11:38:37 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2020-06-26 14:46:42 +1000 |
commit | 6ec5e8b5e7148c3ece1850dffd62a493dbfc2d22 (patch) | |
tree | 55d67e389ce2a3bf6b58cd81d6ea7b85c54ba021 /drivers/crypto/hisilicon/qm.c | |
parent | a05b1c150f5bc0f83313a5e14b94725b5eda5f29 (diff) |
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>
Diffstat (limited to 'drivers/crypto/hisilicon/qm.c')
-rw-r--r-- | drivers/crypto/hisilicon/qm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 13ccb9e29a2e..9762fd1f299d 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -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)) |