Skip to content

Commit a10549f

Browse files
Li Huafeiherbertx
authored andcommitted
crypto: inside-secure - Fix the return value of safexcel_xcbcmac_cra_init()
The commit 320406c ("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: 320406c ("crypto: inside-secure - Replace generic aes with libaes") Signed-off-by: Li Huafei <[email protected]> Acked-by: Antoine Tenart <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent d8920a7 commit a10549f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/crypto/inside-secure/safexcel_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2093,7 +2093,7 @@ static int safexcel_xcbcmac_cra_init(struct crypto_tfm *tfm)
20932093

20942094
safexcel_ahash_cra_init(tfm);
20952095
ctx->aes = kmalloc(sizeof(*ctx->aes), GFP_KERNEL);
2096-
return PTR_ERR_OR_ZERO(ctx->aes);
2096+
return ctx->aes == NULL ? -ENOMEM : 0;
20972097
}
20982098

20992099
static void safexcel_xcbcmac_cra_exit(struct crypto_tfm *tfm)

0 commit comments

Comments
 (0)