Commit 42a1ee56 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by JiangShui
Browse files

crypto: hisilicon/hpre - Fix a erroneous check after snprintf()

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8B6T4
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c97795014672



----------------------------------------------------------------------

This error handling looks really strange.
Check if the string has been truncated instead.

Fixes: 02ab9946 ("crypto: hisilicon - Fixed some tiny bugs of HPRE")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarJiangShui Yang <yangjiangshui@h-partners.com>
parent 6a08d255
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1010,7 +1010,7 @@ static int hpre_cluster_debugfs_init(struct hisi_qm *qm)

	for (i = 0; i < clusters_num; i++) {
		ret = snprintf(buf, HPRE_DBGFS_VAL_MAX_LEN, "cluster%d", i);
		if (ret < 0)
		if (ret >= HPRE_DBGFS_VAL_MAX_LEN)
			return -EINVAL;
		tmp_d = debugfs_create_dir(buf, qm->debug.debug_root);