X.509: fix error return value on the failed path

When memory allocation fails, an appropriate return value
should be set.

Fixes: 2155256396 ("X.509: support OSCCA SM2-with-SM3 certificate verification")
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Tianjia Zhang 2020-10-05 22:46:28 +08:00 committed by Herbert Xu
parent 10a2f0b311
commit 4f28945da0
1 changed files with 3 additions and 1 deletions

View File

@ -36,8 +36,10 @@ int cert_sig_digest_update(const struct public_key_signature *sig,
desc_size = crypto_shash_descsize(tfm) + sizeof(*desc);
desc = kzalloc(desc_size, GFP_KERNEL);
if (!desc)
if (!desc) {
ret = -ENOMEM;
goto error_free_tfm;
}
desc->tfm = tfm;