linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Allison Randal <allison@lohutok.net>,
	Kate Stewart <kstewart@linuxfoundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-crypto <linux-crypto@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/2] async_tx: fix possible negative array indexing
Date: Wed, 18 Mar 2020 08:53:07 -0700	[thread overview]
Message-ID: <CAPcyv4j3Q6n8sj=ATtDL0cpHvMqZPaBxuZ13pgUsvhXWqDh1BA@mail.gmail.com> (raw)
In-Reply-To: <CAHO=5PE9SLg2O1fp5YUp0Z0sbNfKNiu5kGXBRtHmGyXRW5w3pg@mail.gmail.com>

On Wed, Mar 18, 2020 at 12:17 AM Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> On Tue, Mar 17, 2020 at 11:06 PM Dan Williams <dan.j.williams@intel.com> wrote:
> >
> > On Mon, Mar 16, 2020 at 11:16 PM Rayagonda Kokatanur
> > <rayagonda.kokatanur@broadcom.com> wrote:
> > >
> > > Fix possible negative array index read in __2data_recov_5() function.
> > >
> > > Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> > > ---
> > >  crypto/async_tx/async_raid6_recov.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_raid6_recov.c
> > > index 33f2a8f8c9f4..9cd016cb2d09 100644
> > > --- a/crypto/async_tx/async_raid6_recov.c
> > > +++ b/crypto/async_tx/async_raid6_recov.c
> > > @@ -206,7 +206,7 @@ __2data_recov_5(int disks, size_t bytes, int faila, int failb,
> > >                 good_srcs++;
> > >         }
> > >
> > > -       if (good_srcs > 1)
> > > +       if ((good_srcs > 1) || (good < 0))
> > >                 return NULL;
> >
> > Read the code again, I don't see how this can happen.
>
> This case can happen and it is reported by coverity tool.
> In the for loop , the condition "if (blocks[i] == NULL)" true all the
> time then variable 'good' will be -1.

Just because coverity reports it does not make it true. Please go read
the full call path that gets us to this call and identify how all
entries in blocks[] could be NULL. Hint, the answer is in how
async_raid6_2data_recov() calls __2data_recov_5().

      reply	other threads:[~2020-03-18 15:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  6:15 [PATCH v1 0/2] Remove BUG_ON() and fix -ve " Rayagonda Kokatanur
2020-03-17  6:15 ` [PATCH v1 1/2] async_tx: return error instead of BUG_ON Rayagonda Kokatanur
2020-03-17 17:34   ` Dan Williams
2020-03-17  6:15 ` [PATCH v1 2/2] async_tx: fix possible negative array indexing Rayagonda Kokatanur
2020-03-17 17:36   ` Dan Williams
2020-03-18  7:17     ` Rayagonda Kokatanur
2020-03-18 15:53       ` Dan Williams [this message]

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='CAPcyv4j3Q6n8sj=ATtDL0cpHvMqZPaBxuZ13pgUsvhXWqDh1BA@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=allison@lohutok.net \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rayagonda.kokatanur@broadcom.com \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH v1 2/2] async_tx: fix possible negative array indexing' \
    /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

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).