netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* authenc compile warnings in current net-2.6.24
@ 2007-10-10 17:53 Oliver Hartkopp
  2007-10-10 19:53 ` Sebastian Siewior
  0 siblings, 1 reply; 9+ messages in thread
From: Oliver Hartkopp @ 2007-10-10 17:53 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

Hi Herbert,

CC [M] crypto/authenc.o
crypto/authenc.c: In function ‘crypto_authenc_hash’:
crypto/authenc.c:88: warning: ‘cryptlen’ may be used uninitialized in 
this function
crypto/authenc.c:87: warning: ‘dst’ may be used uninitialized in this 
function
crypto/authenc.c: In function ‘crypto_authenc_decrypt’:
crypto/authenc.c:163: warning: ‘cryptlen’ may be used uninitialized in 
this function
crypto/authenc.c:163: note: ‘cryptlen’ was declared here
crypto/authenc.c:162: warning: ‘src’ may be used uninitialized in this 
function
crypto/authenc.c:162: note: ‘src’ was declared here

do you already know these warnings?

Oliver

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

* Re: authenc compile warnings in current net-2.6.24
  2007-10-10 17:53 authenc compile warnings in current net-2.6.24 Oliver Hartkopp
@ 2007-10-10 19:53 ` Sebastian Siewior
  2007-10-10 23:25   ` David Miller
  0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Siewior @ 2007-10-10 19:53 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: Herbert Xu, netdev

* Oliver Hartkopp | 2007-10-10 19:53:53 [+0200]:

> CC [M] crypto/authenc.o
> crypto/authenc.c: In function ?crypto_authenc_hash?:
> crypto/authenc.c:88: warning: ?cryptlen? may be used uninitialized in this 
> function
> crypto/authenc.c:87: warning: ?dst? may be used uninitialized in this 
> function
> crypto/authenc.c: In function ?crypto_authenc_decrypt?:
> crypto/authenc.c:163: warning: ?cryptlen? may be used uninitialized in this 
> function
> crypto/authenc.c:163: note: ?cryptlen? was declared here
> crypto/authenc.c:162: warning: ?src? may be used uninitialized in this 
> function
> crypto/authenc.c:162: note: ?src? was declared here
>
> do you already know these warnings?

Those warnings are looking like a compiler bug to me.

> Oliver

Sebastian

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

* Re: authenc compile warnings in current net-2.6.24
  2007-10-10 19:53 ` Sebastian Siewior
@ 2007-10-10 23:25   ` David Miller
  2007-10-11  3:23     ` Herbert Xu
  2007-10-11 10:58     ` Sebastian Siewior
  0 siblings, 2 replies; 9+ messages in thread
From: David Miller @ 2007-10-10 23:25 UTC (permalink / raw)
  To: netdev; +Cc: socketcan, herbert, netdev

From: Sebastian Siewior <netdev@ml.breakpoint.cc>
Date: Wed, 10 Oct 2007 21:53:37 +0200

> * Oliver Hartkopp | 2007-10-10 19:53:53 [+0200]:
> 
> > CC [M] crypto/authenc.o
> > crypto/authenc.c: In function ?crypto_authenc_hash?:
> > crypto/authenc.c:88: warning: ?cryptlen? may be used uninitialized in this 
> > function
> > crypto/authenc.c:87: warning: ?dst? may be used uninitialized in this 
> > function
> > crypto/authenc.c: In function ?crypto_authenc_decrypt?:
> > crypto/authenc.c:163: warning: ?cryptlen? may be used uninitialized in this 
> > function
> > crypto/authenc.c:163: note: ?cryptlen? was declared here
> > crypto/authenc.c:162: warning: ?src? may be used uninitialized in this 
> > function
> > crypto/authenc.c:162: note: ?src? was declared here
> >
> > do you already know these warnings?
> 
> Those warnings are looking like a compiler bug to me.

It's just not smart enough to see that cryptlen's initialization
and it's use in the auth_unlock label path are both protected
by 'err' being non-zero.

To be honest I don't know of any compiler which commits enough
flow variable analysis to support doing %100 accurate warnings
in situations like this.

Since the compiler is unlikely to do so, I think we should fix
it somehow because useless warnings just distract.

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

* Re: authenc compile warnings in current net-2.6.24
  2007-10-10 23:25   ` David Miller
@ 2007-10-11  3:23     ` Herbert Xu
  2007-10-11  3:26       ` Herbert Xu
  2007-10-11 10:58     ` Sebastian Siewior
  1 sibling, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2007-10-11  3:23 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, socketcan, netdev

On Wed, Oct 10, 2007 at 04:25:28PM -0700, David Miller wrote:
>
> It's just not smart enough to see that cryptlen's initialization
> and it's use in the auth_unlock label path are both protected
> by 'err' being non-zero.
> 
> To be honest I don't know of any compiler which commits enough
> flow variable analysis to support doing %100 accurate warnings
> in situations like this.
> 
> Since the compiler is unlikely to do so, I think we should fix
> it somehow because useless warnings just distract.

Yeah I've added a fix in the cryptodev tree.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: authenc compile warnings in current net-2.6.24
  2007-10-11  3:23     ` Herbert Xu
@ 2007-10-11  3:26       ` Herbert Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2007-10-11  3:26 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, socketcan, netdev, Linux Crypto Mailing List

On Thu, Oct 11, 2007 at 11:23:30AM +0800, Herbert Xu wrote:
>
> Yeah I've added a fix in the cryptodev tree.

Oh and here's the actual patch.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
1cd6038ce42447f9a32e6d138af0b69ad56ea627
diff --git a/crypto/authenc.c b/crypto/authenc.c
index 0b29a6a..126a529 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -84,8 +84,8 @@ static int crypto_authenc_hash(struct aead_request *req)
 		.tfm = auth,
 	};
 	u8 *hash = aead_request_ctx(req);
-	struct scatterlist *dst;
-	unsigned int cryptlen;
+	struct scatterlist *dst = req->dst;
+	unsigned int cryptlen = req->cryptlen;
 	int err;
 
 	hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth), 
@@ -100,8 +100,6 @@ static int crypto_authenc_hash(struct aead_request *req)
 	if (err)
 		goto auth_unlock;
 
-	cryptlen = req->cryptlen;
-	dst = req->dst;
 	err = crypto_hash_update(&desc, dst, cryptlen);
 	if (err)
 		goto auth_unlock;
@@ -159,8 +157,8 @@ static int crypto_authenc_verify(struct aead_request *req)
 	};
 	u8 *ohash = aead_request_ctx(req);
 	u8 *ihash;
-	struct scatterlist *src;
-	unsigned int cryptlen;
+	struct scatterlist *src = req->src;
+	unsigned int cryptlen = req->cryptlen;
 	unsigned int authsize;
 	int err;
 
@@ -177,8 +175,6 @@ static int crypto_authenc_verify(struct aead_request *req)
 	if (err)
 		goto auth_unlock;
 
-	cryptlen = req->cryptlen;
-	src = req->src;
 	err = crypto_hash_update(&desc, src, cryptlen);
 	if (err)
 		goto auth_unlock;

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

* Re: authenc compile warnings in current net-2.6.24
  2007-10-10 23:25   ` David Miller
  2007-10-11  3:23     ` Herbert Xu
@ 2007-10-11 10:58     ` Sebastian Siewior
  2007-10-11 16:38       ` Oliver Hartkopp
  1 sibling, 1 reply; 9+ messages in thread
From: Sebastian Siewior @ 2007-10-11 10:58 UTC (permalink / raw)
  To: David Miller; +Cc: socketcan, herbert, netdev

* David Miller | 2007-10-10 16:25:28 [-0700]:

>From: Sebastian Siewior <netdev@ml.breakpoint.cc>
>Date: Wed, 10 Oct 2007 21:53:37 +0200
>
>> * Oliver Hartkopp | 2007-10-10 19:53:53 [+0200]:
>> 
>> > CC [M] crypto/authenc.o
>> > crypto/authenc.c: In function ?crypto_authenc_hash?:
>> > crypto/authenc.c:88: warning: ?cryptlen? may be used uninitialized in this 
>> > function
>> > crypto/authenc.c:87: warning: ?dst? may be used uninitialized in this 
>> > function
>> > crypto/authenc.c: In function ?crypto_authenc_decrypt?:
>> > crypto/authenc.c:163: warning: ?cryptlen? may be used uninitialized in this 
>> > function
>> > crypto/authenc.c:163: note: ?cryptlen? was declared here
>> > crypto/authenc.c:162: warning: ?src? may be used uninitialized in this 
>> > function
>> > crypto/authenc.c:162: note: ?src? was declared here
>> >
>> > do you already know these warnings?
>> 
>> Those warnings are looking like a compiler bug to me.
>
>To be honest I don't know of any compiler which commits enough
>flow variable analysis to support doing %100 accurate warnings
>in situations like this.

gcc (GCC) 4.1.2 (Gentoo 4.1.2) did not produce any warnings in this
case.

>Since the compiler is unlikely to do so, I think we should fix
>it somehow because useless warnings just distract.
sure.

Sebastian

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

* Re: authenc compile warnings in current net-2.6.24
  2007-10-11 10:58     ` Sebastian Siewior
@ 2007-10-11 16:38       ` Oliver Hartkopp
  0 siblings, 0 replies; 9+ messages in thread
From: Oliver Hartkopp @ 2007-10-11 16:38 UTC (permalink / raw)
  To: Sebastian Siewior, netdev

Sebastian Siewior wrote:
> * David Miller | 2007-10-10 16:25:28 [-0700]:
>
>   
>> From: Sebastian Siewior <netdev@ml.breakpoint.cc>
>> Date: Wed, 10 Oct 2007 21:53:37 +0200
>>
>>     
>>> * Oliver Hartkopp | 2007-10-10 19:53:53 [+0200]:
>>>
>>>       
>>>> CC [M] crypto/authenc.o
>>>> crypto/authenc.c: In function ?crypto_authenc_hash?:
>>>> crypto/authenc.c:88: warning: ?cryptlen? may be used uninitialized in this 
>>>> function
>>>> crypto/authenc.c:87: warning: ?dst? may be used uninitialized in this 
>>>> function
>>>> crypto/authenc.c: In function ?crypto_authenc_decrypt?:
>>>> crypto/authenc.c:163: warning: ?cryptlen? may be used uninitialized in this 
>>>> function
>>>> crypto/authenc.c:163: note: ?cryptlen? was declared here
>>>> crypto/authenc.c:162: warning: ?src? may be used uninitialized in this 
>>>> function
>>>> crypto/authenc.c:162: note: ?src? was declared here
>>>>
>>>> do you already know these warnings?
>>>>         
>>> Those warnings are looking like a compiler bug to me.
>>>       
>> To be honest I don't know of any compiler which commits enough
>> flow variable analysis to support doing %100 accurate warnings
>> in situations like this.
>>     
>
> gcc (GCC) 4.1.2 (Gentoo 4.1.2) did not produce any warnings in this
> case.
>
>   

Hi Sebasian,

my gcc was the lastest Debian unstable one:

gcc -v

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr 
--enable-shared --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --enable-nls 
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr 
--enable-targets=all --disable-werror --enable-checking=release 
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.1 (Debian 4.2.1-5)

Regards,
Oliver



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

* Re: authenc compile warnings in current net-2.6.24
@ 2007-10-12  6:15 Oliver Hartkopp
  2007-10-12 10:18 ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Oliver Hartkopp @ 2007-10-12  6:15 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, netdev

Hi Dave,

this compile fix seems not to be applied (maybe my compiler is the only 
one who complains ;-)

Acked-by: Oliver Hartkopp <oliver@hartkopp.net>

Thanks!


On Thu, Oct 11, 2007 at 11:23:30AM +0800, Herbert Xu wrote:
>
> Yeah I've added a fix in the cryptodev tree.

Oh and here's the actual patch.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
1cd6038ce42447f9a32e6d138af0b69ad56ea627
diff --git a/crypto/authenc.c b/crypto/authenc.c
index 0b29a6a..126a529 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -84,8 +84,8 @@ static int crypto_authenc_hash(struct aead_request *req)
 		.tfm = auth,
 	};
 	u8 *hash = aead_request_ctx(req);
-	struct scatterlist *dst;
-	unsigned int cryptlen;
+	struct scatterlist *dst = req->dst;
+	unsigned int cryptlen = req->cryptlen;
 	int err;
 
 	hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth), 
@@ -100,8 +100,6 @@ static int crypto_authenc_hash(struct aead_request *req)
 	if (err)
 		goto auth_unlock;
 
-	cryptlen = req->cryptlen;
-	dst = req->dst;
 	err = crypto_hash_update(&desc, dst, cryptlen);
 	if (err)
 		goto auth_unlock;
@@ -159,8 +157,8 @@ static int crypto_authenc_verify(struct aead_request *req)
 	};
 	u8 *ohash = aead_request_ctx(req);
 	u8 *ihash;
-	struct scatterlist *src;
-	unsigned int cryptlen;
+	struct scatterlist *src = req->src;
+	unsigned int cryptlen = req->cryptlen;
 	unsigned int authsize;
 	int err;
 
@@ -177,8 +175,6 @@ static int crypto_authenc_verify(struct aead_request *req)
 	if (err)
 		goto auth_unlock;
 
-	cryptlen = req->cryptlen;
-	src = req->src;
 	err = crypto_hash_update(&desc, src, cryptlen);
 	if (err)
 		goto auth_unlock;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: authenc compile warnings in current net-2.6.24
  2007-10-12  6:15 Oliver Hartkopp
@ 2007-10-12 10:18 ` Herbert Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2007-10-12 10:18 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: David Miller, netdev

On Fri, Oct 12, 2007 at 08:15:01AM +0200, Oliver Hartkopp wrote:
> Hi Dave,
> 
> this compile fix seems not to be applied (maybe my compiler is the only 
> one who complains ;-)

That's because the patch is in my cryptodev-2.6 tree :)

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2007-10-12 10:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10 17:53 authenc compile warnings in current net-2.6.24 Oliver Hartkopp
2007-10-10 19:53 ` Sebastian Siewior
2007-10-10 23:25   ` David Miller
2007-10-11  3:23     ` Herbert Xu
2007-10-11  3:26       ` Herbert Xu
2007-10-11 10:58     ` Sebastian Siewior
2007-10-11 16:38       ` Oliver Hartkopp
  -- strict thread matches above, loose matches on Subject: below --
2007-10-12  6:15 Oliver Hartkopp
2007-10-12 10:18 ` 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).