crypto: In crypto_add_alg(), 'exact' wants to be initialized to 0
authorJesper Juhl <jj@chaosbits.net>
Sun, 29 Jan 2012 22:39:22 +0000 (23:39 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 5 Feb 2012 04:12:25 +0000 (15:12 +1100)
We declare 'exact' without initializing it and then do:

[...]
if (strlen(p->cru_driver_name))
exact = 1;

if (priority && !exact)
return -EINVAL;

[...]

If the first 'if' is not true, then the second will test an
uninitialized 'exact'.
As far as I can tell, what we want is for 'exact' to be initialized to
0 (zero/false).

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/crypto_user.c

index 3ba6ef508869d104db2657423e451c3922db5f45..3e61cc101e8353e7534124f34b9a17f7b7da09f6 100644 (file)
@@ -304,7 +304,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
 static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
                          struct nlattr **attrs)
 {
-       int exact;
+       int exact = 0;
        const char *name;
        struct crypto_alg *alg;
        struct crypto_user_alg *p = nlmsg_data(nlh);