All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
@ 2017-03-17 20:46 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2017-03-17 20:46 UTC (permalink / raw)
  To: Herbert Xu, Mahipal Challa
  Cc: David S. Miller, Jan Glauber, linux-crypto, kernel-janitors

There is a typo here.  It should be "stats" instead of "state".  The
impact is that we clear 224 bytes instead of 80 and we zero out memory
that we shouldn't.

Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
index 0951e20b395b..6ff13d80d82e 100644
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
 	for (index = 0; index < MAX_ZIP_DEVICES; index++) {
 		if (zip_dev[index]) {
 			memset(&zip_dev[index]->stats, 0,
-			       sizeof(struct zip_state));
+			       sizeof(struct zip_stats));
 			seq_printf(s, "Cleared stats for zip %d\n", index);
 		}
 	}

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

* [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
@ 2017-03-17 20:46 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2017-03-17 20:46 UTC (permalink / raw)
  To: Herbert Xu, Mahipal Challa
  Cc: David S. Miller, Jan Glauber, linux-crypto, kernel-janitors

There is a typo here.  It should be "stats" instead of "state".  The
impact is that we clear 224 bytes instead of 80 and we zero out memory
that we shouldn't.

Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
index 0951e20b395b..6ff13d80d82e 100644
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
 	for (index = 0; index < MAX_ZIP_DEVICES; index++) {
 		if (zip_dev[index]) {
 			memset(&zip_dev[index]->stats, 0,
-			       sizeof(struct zip_state));
+			       sizeof(struct zip_stats));
 			seq_printf(s, "Cleared stats for zip %d\n", index);
 		}
 	}

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

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
  2017-03-17 20:46 ` Dan Carpenter
@ 2017-03-18 10:24   ` walter harms
  -1 siblings, 0 replies; 10+ messages in thread
From: walter harms @ 2017-03-18 10:24 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Herbert Xu, Mahipal Challa, David S. Miller, Jan Glauber,
	linux-crypto, kernel-janitors



Am 17.03.2017 21:46, schrieb Dan Carpenter:
> There is a typo here.  It should be "stats" instead of "state".  The
> impact is that we clear 224 bytes instead of 80 and we zero out memory
> that we shouldn't.
> 
> Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
> index 0951e20b395b..6ff13d80d82e 100644
> --- a/drivers/crypto/cavium/zip/zip_main.c
> +++ b/drivers/crypto/cavium/zip/zip_main.c
> @@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
>  	for (index = 0; index < MAX_ZIP_DEVICES; index++) {
>  		if (zip_dev[index]) {
>  			memset(&zip_dev[index]->stats, 0,
> -			       sizeof(struct zip_state));
> +			       sizeof(struct zip_stats));


as future FIXME some show find a name that differ in more than just the last char.
NTL maybe
 sizeof(zip_dev[index]->stats)
can be used here ?

re,
 wh

>  			seq_printf(s, "Cleared stats for zip %d\n", index);
>  		}
>  	}
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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	[flat|nested] 10+ messages in thread

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
@ 2017-03-18 10:24   ` walter harms
  0 siblings, 0 replies; 10+ messages in thread
From: walter harms @ 2017-03-18 10:24 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Herbert Xu, Mahipal Challa, David S. Miller, Jan Glauber,
	linux-crypto, kernel-janitors



Am 17.03.2017 21:46, schrieb Dan Carpenter:
> There is a typo here.  It should be "stats" instead of "state".  The
> impact is that we clear 224 bytes instead of 80 and we zero out memory
> that we shouldn't.
> 
> Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
> index 0951e20b395b..6ff13d80d82e 100644
> --- a/drivers/crypto/cavium/zip/zip_main.c
> +++ b/drivers/crypto/cavium/zip/zip_main.c
> @@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
>  	for (index = 0; index < MAX_ZIP_DEVICES; index++) {
>  		if (zip_dev[index]) {
>  			memset(&zip_dev[index]->stats, 0,
> -			       sizeof(struct zip_state));
> +			       sizeof(struct zip_stats));


as future FIXME some show find a name that differ in more than just the last char.
NTL maybe
 sizeof(zip_dev[index]->stats)
can be used here ?

re,
 wh

>  			seq_printf(s, "Cleared stats for zip %d\n", index);
>  		}
>  	}
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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	[flat|nested] 10+ messages in thread

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
  2017-03-18 10:24   ` walter harms
@ 2017-03-18 10:59     ` Dan Carpenter
  -1 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2017-03-18 10:59 UTC (permalink / raw)
  To: walter harms
  Cc: Herbert Xu, Mahipal Challa, David S. Miller, Jan Glauber,
	linux-crypto, kernel-janitors

On Sat, Mar 18, 2017 at 11:24:34AM +0100, walter harms wrote:
> 
> 
> Am 17.03.2017 21:46, schrieb Dan Carpenter:
> > There is a typo here.  It should be "stats" instead of "state".  The
> > impact is that we clear 224 bytes instead of 80 and we zero out memory
> > that we shouldn't.
> > 
> > Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
> > index 0951e20b395b..6ff13d80d82e 100644
> > --- a/drivers/crypto/cavium/zip/zip_main.c
> > +++ b/drivers/crypto/cavium/zip/zip_main.c
> > @@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
> >  	for (index = 0; index < MAX_ZIP_DEVICES; index++) {
> >  		if (zip_dev[index]) {
> >  			memset(&zip_dev[index]->stats, 0,
> > -			       sizeof(struct zip_state));
> > +			       sizeof(struct zip_stats));
> 
> 
> as future FIXME some show find a name that differ in more than just the last char.
> NTL maybe
>  sizeof(zip_dev[index]->stats)
> can be used here ?

That's sort of unweildy.  I don't fear that change because I'm confident
I would catch it with static analysis.

regards,
dan carpenter


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

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
@ 2017-03-18 10:59     ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2017-03-18 10:59 UTC (permalink / raw)
  To: walter harms
  Cc: Herbert Xu, Mahipal Challa, David S. Miller, Jan Glauber,
	linux-crypto, kernel-janitors

On Sat, Mar 18, 2017 at 11:24:34AM +0100, walter harms wrote:
> 
> 
> Am 17.03.2017 21:46, schrieb Dan Carpenter:
> > There is a typo here.  It should be "stats" instead of "state".  The
> > impact is that we clear 224 bytes instead of 80 and we zero out memory
> > that we shouldn't.
> > 
> > Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
> > index 0951e20b395b..6ff13d80d82e 100644
> > --- a/drivers/crypto/cavium/zip/zip_main.c
> > +++ b/drivers/crypto/cavium/zip/zip_main.c
> > @@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
> >  	for (index = 0; index < MAX_ZIP_DEVICES; index++) {
> >  		if (zip_dev[index]) {
> >  			memset(&zip_dev[index]->stats, 0,
> > -			       sizeof(struct zip_state));
> > +			       sizeof(struct zip_stats));
> 
> 
> as future FIXME some show find a name that differ in more than just the last char.
> NTL maybe
>  sizeof(zip_dev[index]->stats)
> can be used here ?

That's sort of unweildy.  I don't fear that change because I'm confident
I would catch it with static analysis.

regards,
dan carpenter


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

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
  2017-03-18 10:59     ` Dan Carpenter
@ 2017-03-20 14:34       ` Mahipal Reddy
  -1 siblings, 0 replies; 10+ messages in thread
From: Mahipal Reddy @ 2017-03-20 14:22 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: walter harms, Herbert Xu, David S. Miller, Jan Glauber,
	linux-crypto, kernel-janitors

On Sat, Mar 18, 2017 at 4:29 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Sat, Mar 18, 2017 at 11:24:34AM +0100, walter harms wrote:
>>
>>
>> Am 17.03.2017 21:46, schrieb Dan Carpenter:
>> > There is a typo here.  It should be "stats" instead of "state".  The
>> > impact is that we clear 224 bytes instead of 80 and we zero out memory
>> > that we shouldn't.

Thank you Dan for identifying the issue. Yes there is a typo and it needs a fix.


>> > Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
>> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> >
>> > diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
>> > index 0951e20b395b..6ff13d80d82e 100644
>> > --- a/drivers/crypto/cavium/zip/zip_main.c
>> > +++ b/drivers/crypto/cavium/zip/zip_main.c
>> > @@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
>> >     for (index = 0; index < MAX_ZIP_DEVICES; index++) {
>> >             if (zip_dev[index]) {
>> >                     memset(&zip_dev[index]->stats, 0,
>> > -                          sizeof(struct zip_state));
>> > +                          sizeof(struct zip_stats));

Yes this resolves the issue.
Thanks for this fix.
Mahipal

>>
>> as future FIXME some show find a name that differ in more than just the last char.
>> NTL maybe
>>  sizeof(zip_dev[index]->stats)
>> can be used here ?
>
> That's sort of unweildy.  I don't fear that change because I'm confident
> I would catch it with static analysis.
>
> regards,
> dan carpenter
>

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

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
@ 2017-03-20 14:34       ` Mahipal Reddy
  0 siblings, 0 replies; 10+ messages in thread
From: Mahipal Reddy @ 2017-03-20 14:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: walter harms, Herbert Xu, David S. Miller, Jan Glauber,
	linux-crypto, kernel-janitors

On Sat, Mar 18, 2017 at 4:29 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Sat, Mar 18, 2017 at 11:24:34AM +0100, walter harms wrote:
>>
>>
>> Am 17.03.2017 21:46, schrieb Dan Carpenter:
>> > There is a typo here.  It should be "stats" instead of "state".  The
>> > impact is that we clear 224 bytes instead of 80 and we zero out memory
>> > that we shouldn't.

Thank you Dan for identifying the issue. Yes there is a typo and it needs a fix.


>> > Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
>> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> >
>> > diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
>> > index 0951e20b395b..6ff13d80d82e 100644
>> > --- a/drivers/crypto/cavium/zip/zip_main.c
>> > +++ b/drivers/crypto/cavium/zip/zip_main.c
>> > @@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void *unused)
>> >     for (index = 0; index < MAX_ZIP_DEVICES; index++) {
>> >             if (zip_dev[index]) {
>> >                     memset(&zip_dev[index]->stats, 0,
>> > -                          sizeof(struct zip_state));
>> > +                          sizeof(struct zip_stats));

Yes this resolves the issue.
Thanks for this fix.
Mahipal

>>
>> as future FIXME some show find a name that differ in more than just the last char.
>> NTL maybe
>>  sizeof(zip_dev[index]->stats)
>> can be used here ?
>
> That's sort of unweildy.  I don't fear that change because I'm confident
> I would catch it with static analysis.
>
> regards,
> dan carpenter
>

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

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
  2017-03-17 20:46 ` Dan Carpenter
@ 2017-03-24 14:14   ` Herbert Xu
  -1 siblings, 0 replies; 10+ messages in thread
From: Herbert Xu @ 2017-03-24 14:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mahipal Challa, David S. Miller, Jan Glauber, linux-crypto,
	kernel-janitors

On Fri, Mar 17, 2017 at 11:46:21PM +0300, Dan Carpenter wrote:
> There is a typo here.  It should be "stats" instead of "state".  The
> impact is that we clear 224 bytes instead of 80 and we zero out memory
> that we shouldn't.
> 
> Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <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] 10+ messages in thread

* Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
@ 2017-03-24 14:14   ` Herbert Xu
  0 siblings, 0 replies; 10+ messages in thread
From: Herbert Xu @ 2017-03-24 14:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mahipal Challa, David S. Miller, Jan Glauber, linux-crypto,
	kernel-janitors

On Fri, Mar 17, 2017 at 11:46:21PM +0300, Dan Carpenter wrote:
> There is a typo here.  It should be "stats" instead of "state".  The
> impact is that we clear 224 bytes instead of 80 and we zero out memory
> that we shouldn't.
> 
> Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <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] 10+ messages in thread

end of thread, other threads:[~2017-03-24 14:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-17 20:46 [PATCH] crypto: zip - Memory corruption in zip_clear_stats() Dan Carpenter
2017-03-17 20:46 ` Dan Carpenter
2017-03-18 10:24 ` walter harms
2017-03-18 10:24   ` walter harms
2017-03-18 10:59   ` Dan Carpenter
2017-03-18 10:59     ` Dan Carpenter
2017-03-20 14:22     ` Mahipal Reddy
2017-03-20 14:34       ` Mahipal Reddy
2017-03-24 14:14 ` Herbert Xu
2017-03-24 14:14   ` Herbert Xu

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.