On Tue, Aug 16, 2022 at 11:37:22AM +0000, cgel.zte@xxxxxxxxx wrote: > 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); > } > -- How does this new NULL check do anything when the pointer is unconditionally dereferenced in the previous line? - Eric