crypto: hisilicon/hpre - Fix a erroneous check after snprintf()
[ Upstream commit c977950146720abff14e46d8c53f5638b06a9182 ]
This error handling looks really strange.
Check if the string has been truncated instead.
Fixes: 02ab994635
("crypto: hisilicon - Fixed some tiny bugs of HPRE")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5176ebe6aa
commit
02db438311
@ -637,7 +637,7 @@ static int hpre_cluster_debugfs_init(struct hisi_qm *qm)
|
||||
|
||||
for (i = 0; i < HPRE_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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user