linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: LABBE Corentin <clabbe.montjoie@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpio: 74xx: fix a possible NULL dereference
Date: Tue, 10 Nov 2015 08:16:11 +0100	[thread overview]
Message-ID: <20151110071611.GA21382@Red> (raw)
In-Reply-To: <CAHp75VdfzUhK1dOjxkkj_0ZCZyWFPRwvyE8CGgsUfdgj6Afe4w@mail.gmail.com>

On Mon, Nov 09, 2015 at 04:16:16PM +0200, Andy Shevchenko wrote:
> On Mon, Nov 9, 2015 at 2:21 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
> > On Fri, Nov 6, 2015 at 12:55 AM, LABBE Corentin
> > <clabbe.montjoie@gmail.com> wrote:
> >> of_match_device could return NULL, and so cause a NULL pointer
> >> dereference later at line 132:
> >> priv->flags = (uintptr_t) of_id->data;
> >>
> >> Reported-by: coverity (CID 1324141)
> >> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
> >> ---
> >>  drivers/gpio/gpio-74xx-mmio.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/gpio/gpio-74xx-mmio.c b/drivers/gpio/gpio-74xx-mmio.c
> >> index 6ed7c0f..4a7be0f 100644
> >> --- a/drivers/gpio/gpio-74xx-mmio.c
> >> +++ b/drivers/gpio/gpio-74xx-mmio.c
> >> @@ -120,6 +120,9 @@ static int mmio_74xx_gpio_probe(struct platform_device *pdev)
> >>         void __iomem *dat;
> >>         int err;
> >>
> >> +       if (!of_id)
> >> +               return -ENODEV;
> >> +
> >
> > Nit: in that case, could you also move the assignment of of_id to its
> > own line right above these added lines? It would keep things in the
> > same place
> 
> I think it's more that just a nit. +1 to move assignment.

Hello

I agree, I will send an updated patch soon.

Regards

LABBE Corentin

      reply	other threads:[~2015-11-10  7:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 15:55 [PATCH] gpio: 74xx: fix a possible NULL dereference LABBE Corentin
2015-11-09  0:21 ` Alexandre Courbot
2015-11-09 14:16   ` Andy Shevchenko
2015-11-10  7:16     ` LABBE Corentin [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=20151110071611.GA21382@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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 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).