From: Jesper Juhl Date: Sun, 29 Jan 2012 22:39:22 +0000 (+0100) Subject: crypto: In crypto_add_alg(), 'exact' wants to be initialized to 0 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0cfdec7a65c98de6637e547a04a33969dc9c61b1;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git crypto: In crypto_add_alg(), 'exact' wants to be initialized to 0 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 Acked-by: Steffen Klassert Signed-off-by: Herbert Xu --- diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 3ba6ef508869..3e61cc101e83 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c @@ -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);