From: GUO Zihua guozihua@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I5Z7MD CVE: NA
--------------------------------
Return of crypto_alloc_shash would be either a valid pointer or an error pointer. We should check the result with IS_ERR.
Signed-off-by: GUO Zihua guozihua@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- crypto/asymmetric_keys/pgp_public_key.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/asymmetric_keys/pgp_public_key.c b/crypto/asymmetric_keys/pgp_public_key.c index 928029a13435..e49bb79736da 100644 --- a/crypto/asymmetric_keys/pgp_public_key.c +++ b/crypto/asymmetric_keys/pgp_public_key.c @@ -131,7 +131,7 @@ static int pgp_generate_fingerprint(struct pgp_key_data_parse_context *ctx, ret = -ENOMEM; tfm = crypto_alloc_shash(pgp->version < PGP_KEY_VERSION_4 ? "md5" : "sha1", 0, 0); - if (!tfm) + if (IS_ERR(tfm)) goto cleanup;
digest = kmalloc(sizeof(*digest) + crypto_shash_descsize(tfm),