All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: [PATCH] crypto: fix error flow of crypto/testmgr.c:test_comp()
Date: Tue, 25 Nov 2008 09:58:21 +0100	[thread overview]
Message-ID: <20081125085820.GA11401@elte.hu> (raw)
In-Reply-To: <20081011021357.GB3685@gondor.apana.org.au>


Noticed the bug below while running our -Werror x86 randconfig build 
tests against tip/master. Please double check my control flow 
analysis.

	Ingo

---------->
From e5c3b90a18b73d593bba2a3f927a79469b6218d7 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Tue, 25 Nov 2008 09:47:28 +0100
Subject: [PATCH] crypto: fix error flow of crypto/testmgr.c:test_comp()
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

this warning:

  crypto/testmgr.c: In function ‘test_comp’:
  crypto/testmgr.c:829: warning: ‘ret’ may be used uninitialized in this function

triggers because GCC correctly notices that in the ctcount == 0 &&
dtcount != 0 input condition case this function can return an undefined
value, if the second loop fails.

Remove the shadowed 'ret' variable from the second loop that was probably
unintended.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 crypto/testmgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index b828c6c..0cf0ae3 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -853,7 +853,7 @@ static int test_comp(struct crypto_comp *tfm, struct comp_testvec *ctemplate,
 	}
 
 	for (i = 0; i < dtcount; i++) {
-		int ilen, ret, dlen = COMP_BUF_SIZE;
+		int ilen, dlen = COMP_BUF_SIZE;
 
 		memset(result, 0, sizeof (result));
 

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@elte.hu>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: [PATCH] crypto: fix error flow of crypto/testmgr.c:test_comp()
Date: Tue, 25 Nov 2008 09:58:21 +0100	[thread overview]
Message-ID: <20081125085820.GA11401@elte.hu> (raw)
In-Reply-To: <20081011021357.GB3685@gondor.apana.org.au>


Noticed the bug below while running our -Werror x86 randconfig build 
tests against tip/master. Please double check my control flow 
analysis.

	Ingo

---------->
>From e5c3b90a18b73d593bba2a3f927a79469b6218d7 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Tue, 25 Nov 2008 09:47:28 +0100
Subject: [PATCH] crypto: fix error flow of crypto/testmgr.c:test_comp()
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

this warning:

  crypto/testmgr.c: In function ‘test_comp’:
  crypto/testmgr.c:829: warning: ‘ret’ may be used uninitialized in this function

triggers because GCC correctly notices that in the ctcount == 0 &&
dtcount != 0 input condition case this function can return an undefined
value, if the second loop fails.

Remove the shadowed 'ret' variable from the second loop that was probably
unintended.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 crypto/testmgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index b828c6c..0cf0ae3 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -853,7 +853,7 @@ static int test_comp(struct crypto_comp *tfm, struct comp_testvec *ctemplate,
 	}
 
 	for (i = 0; i < dtcount; i++) {
-		int ilen, ret, dlen = COMP_BUF_SIZE;
+		int ilen, dlen = COMP_BUF_SIZE;
 
 		memset(result, 0, sizeof (result));
 


  reply	other threads:[~2008-11-25  8:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-21  2:43 Crypto Update for 2.6.26 Herbert Xu
2008-04-21  2:43 ` Herbert Xu
2008-07-14 12:14 ` Crypto Update for 2.6.27 Herbert Xu
2008-07-14 12:14 ` Herbert Xu
2008-10-10  7:09   ` Crypto Update for 2.6.28 Herbert Xu
2008-10-10  7:09     ` Herbert Xu
2008-10-10 18:22     ` Linus Torvalds
2008-10-10 18:29       ` Randy Dunlap
2008-10-11  2:13       ` Herbert Xu
2008-11-25  8:58         ` Ingo Molnar [this message]
2008-11-25  8:58           ` [PATCH] crypto: fix error flow of crypto/testmgr.c:test_comp() Ingo Molnar
2008-11-25 15:20           ` Herbert Xu
2008-11-25 17:14             ` Ingo Molnar
2008-11-25 17:14               ` Ingo Molnar
2008-11-25 17:26               ` Patrick McHardy
2008-11-25 21:52               ` David Miller
2008-11-26  1:09                 ` [warnings] 37 warning fixes in networking related files Ingo Molnar
2008-11-26  1:09                   ` Ingo Molnar
2008-11-26  1:11                   ` David Miller
2008-11-26  1:08               ` [PATCH] crypto: fix error flow of crypto/testmgr.c:test_comp() David Miller
2008-11-26  2:40                 ` Ingo Molnar
2008-12-10 12:35         ` Crypto Update for 2.6.28 Herbert Xu
2008-12-24 22:20           ` Herbert Xu
2008-12-24 22:32             ` Linus Torvalds
2008-12-24 23:47               ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081125085820.GA11401@elte.hu \
    --to=mingo@elte.hu \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.