All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: walter harms <wharms@bfs.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Mahipal Challa <mahipalreddy2006@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jan Glauber <jglauber@cavium.com>,
	linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
Date: Sat, 18 Mar 2017 10:59:27 +0000	[thread overview]
Message-ID: <20170318105927.GA4343@mwanda> (raw)
In-Reply-To: <58CD0AE2.3070006@bfs.de>

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


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: walter harms <wharms@bfs.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Mahipal Challa <mahipalreddy2006@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jan Glauber <jglauber@cavium.com>,
	linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()
Date: Sat, 18 Mar 2017 13:59:27 +0300	[thread overview]
Message-ID: <20170318105927.GA4343@mwanda> (raw)
In-Reply-To: <58CD0AE2.3070006@bfs.de>

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


  reply	other threads:[~2017-03-18 10:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20170318105927.GA4343@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jglauber@cavium.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=mahipalreddy2006@gmail.com \
    --cc=wharms@bfs.de \
    /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.