On Thu, Jun 04, 2020 at 11:32:04AM +0800, Zhangfei Gao wrote:I think we do not need consider overrun, since it at most copy size-1 bytes to dest.
Use strlcpy to fix the warningShould this even allow truncation? Perhaps it'd be better to fail
warning: 'strncpy' specified bound 64 equals destination size
[-Wstringop-truncation]
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Zhangfei Gao <zhangfei.gao@xxxxxxxxxx>
---
drivers/crypto/hisilicon/qm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index f795fb5..224f3e2 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -1574,7 +1574,7 @@ static int qm_alloc_uacce(struct hisi_qm *qm)
.ops = &uacce_qm_ops,
};
- strncpy(interface.name, pdev->driver->name, sizeof(interface.name));
+ strlcpy(interface.name, pdev->driver->name, sizeof(interface.name));
in case of an overrun?