From: Weili Qian Date: Sat, 31 Oct 2020 09:07:05 +0000 (+0800) Subject: crypto: hisilicon/qm - replace 'sprintf' with 'scnprintf' X-Git-Tag: v5.11-rc1~199^2~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09493afbc62781bd9fba6224af89fd78fe33b8ba;p=thirdparty%2Fkernel%2Flinux.git crypto: hisilicon/qm - replace 'sprintf' with 'scnprintf' Replace 'sprintf' with 'scnprintf' to avoid overrun. Signed-off-by: Weili Qian Reviewed-by: Zhou Wang Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 17f84dbc8bbe4..25c54146cca16 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -932,7 +932,8 @@ static ssize_t qm_debug_read(struct file *filp, char __user *buf, return -EINVAL; } mutex_unlock(&file->lock); - ret = sprintf(tbuf, "%u\n", val); + + ret = scnprintf(tbuf, QM_DBG_TMP_BUF_LEN, "%u\n", val); return simple_read_from_buffer(buf, count, pos, tbuf, ret); }