From: ye xingchen <ye.xingchen@xxxxxxxxxx> When we have no primary larval or when it's a software node, we may end up in the situation when larval is a NULL pointer. There is no point to look for secondary larval in such case. Add a necessary check to a condition. Reported-by: Zeal Robot <zealci@xxxxxxxxxx> Signed-off-by: ye xingchen <ye.xingchen@xxxxxxxxxx> --- crypto/api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/api.c b/crypto/api.c index 69508ae9345e..f2399aac831d 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -96,7 +96,7 @@ static void crypto_larval_destroy(struct crypto_alg *alg) struct crypto_larval *larval = (void *)alg; BUG_ON(!crypto_is_larval(alg)); - if (!IS_ERR_OR_NULL(larval->adult)) + if (larval && !IS_ERR_OR_NULL(larval->adult)) crypto_mod_put(larval->adult); kfree(larval); } -- 2.25.1