diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2023-09-04 22:17:29 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-09-15 12:29:45 +0200 |
commit | c977950146720abff14e46d8c53f5638b06a9182 (patch) | |
tree | 572a311b8a1bd92bf9e4b77a85e23e0f86b755c9 /drivers | |
parent | crypto: pcrypt - Fix hungtask for PADATA_RESET (diff) | |
download | linux-c977950146720abff14e46d8c53f5638b06a9182.tar.xz linux-c977950146720abff14e46d8c53f5638b06a9182.zip |
crypto: hisilicon/hpre - Fix a erroneous check after snprintf()
This error handling looks really strange.
Check if the string has been truncated instead.
Fixes: 02ab994635eb ("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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/crypto/hisilicon/hpre/hpre_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index 39297ce70f44..db44d889438a 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -1033,7 +1033,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); |