mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
crypto: inside-secure - Fix the return value of safexcel_xcbcmac_cra_init()
The commit320406cb60
("crypto: inside-secure - Replace generic aes with libaes") replaced crypto_alloc_cipher() with kmalloc(), but did not modify the handling of the return value. When kmalloc() returns NULL, PTR_ERR_OR_ZERO(NULL) returns 0, but in fact, the memory allocation has failed, and -ENOMEM should be returned. Fixes:320406cb60
("crypto: inside-secure - Replace generic aes with libaes") Signed-off-by: Li Huafei <lihuafei1@huawei.com> Acked-by: Antoine Tenart <atenart@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
d8920a722a
commit
a10549fcce
@ -2093,7 +2093,7 @@ static int safexcel_xcbcmac_cra_init(struct crypto_tfm *tfm)
|
||||
|
||||
safexcel_ahash_cra_init(tfm);
|
||||
ctx->aes = kmalloc(sizeof(*ctx->aes), GFP_KERNEL);
|
||||
return PTR_ERR_OR_ZERO(ctx->aes);
|
||||
return ctx->aes == NULL ? -ENOMEM : 0;
|
||||
}
|
||||
|
||||
static void safexcel_xcbcmac_cra_exit(struct crypto_tfm *tfm)
|
||||
|
Loading…
Reference in New Issue
Block a user