Skip to content

Commit 4f28945

Browse files
uudiinherbertx
authored andcommitted
X.509: fix error return value on the failed path
When memory allocation fails, an appropriate return value should be set. Fixes: 2155256 ("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>
1 parent 10a2f0b commit 4f28945

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

crypto/asymmetric_keys/public_key_sm2.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ int cert_sig_digest_update(const struct public_key_signature *sig,
3636

3737
desc_size = crypto_shash_descsize(tfm) + sizeof(*desc);
3838
desc = kzalloc(desc_size, GFP_KERNEL);
39-
if (!desc)
39+
if (!desc) {
40+
ret = -ENOMEM;
4041
goto error_free_tfm;
42+
}
4143

4244
desc->tfm = tfm;
4345

0 commit comments

Comments
 (0)