2010-04-28 08:55:36

by Dan Carpenter

[permalink] [raw]
Subject: [patch] crypto: cleanup: remove unneeded null check

We don't check "frontend" consistently in crypto_init_spawn2(). We
check it at the start of the function but then we dereference it
unconditionally in the parameter list when we call crypto_init_spawn().

I looked at the places that call crypto_init_spawn2() and "frontend" is
always a valid pointer so I removed the check for null.

Signed-off-by: Dan Carpenter <[email protected]>

diff --git a/crypto/algapi.c b/crypto/algapi.c
index 76fae27..c3cf1a6 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -544,7 +544,7 @@ int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg,
{
int err = -EINVAL;

- if (frontend && (alg->cra_flags ^ frontend->type) & frontend->maskset)
+ if ((alg->cra_flags ^ frontend->type) & frontend->maskset)
goto out;

spawn->frontend = frontend;


2010-05-03 03:08:55

by Herbert Xu

[permalink] [raw]
Subject: Re: [patch] crypto: cleanup: remove unneeded null check

On Wed, Apr 28, 2010 at 10:55:15AM +0200, Dan Carpenter wrote:
> We don't check "frontend" consistently in crypto_init_spawn2(). We
> check it at the start of the function but then we dereference it
> unconditionally in the parameter list when we call crypto_init_spawn().
>
> I looked at the places that call crypto_init_spawn2() and "frontend" is
> always a valid pointer so I removed the check for null.
>
> Signed-off-by: Dan Carpenter <[email protected]>

Patch applied. Thanks!
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt