linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] In crypto_add_alg(), 'exact' wants to be initialized to 0
@ 2012-01-29 22:39 Jesper Juhl
  2012-02-01 10:43 ` devendra.aaru
  0 siblings, 1 reply; 8+ messages in thread
From: Jesper Juhl @ 2012-01-29 22:39 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: linux-kernel, linux-crypto, Steffen Klassert

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>
---
 crypto/crypto_user.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

  Compile tested only.

diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index 16f8693..36a2af7 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);
-- 
1.7.8.4


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-05  4:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29 22:39 [PATCH] In crypto_add_alg(), 'exact' wants to be initialized to 0 Jesper Juhl
2012-02-01 10:43 ` devendra.aaru
2012-02-01 20:21   ` Jesper Juhl
2012-02-01 20:36     ` Jesper Juhl
2012-02-02  7:51     ` Steffen Klassert
2012-02-02 14:42       ` Jesper Juhl
2012-02-03  6:24         ` Steffen Klassert
2012-02-05  4:12           ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).