linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Courbot <gnurou@gmail.com>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: 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] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe
Date: Wed, 3 Feb 2016 08:30:39 +0900	[thread overview]
Message-ID: <CAAVeFuKwZ7r_8weyMWY4NrjREWaefzUWhVbh_V75FiJsWs5QMA@mail.gmail.com> (raw)
In-Reply-To: <1454015092-11416-1-git-send-email-xerofoify@gmail.com>

On Fri, Jan 29, 2016 at 6:04 AM, Nicholas Krause <xerofoify@gmail.com> wrote:
> This fixes a possible NULL pointer deference in the function,
> davinci_gpio_probe due to the function, gpio2regs being able
> to return a NULL pointer if it rans to get the registers for
> the gpio devices on a davinci board. Furthermore if this does
> arise return -ENXIO to signal callers that this case has arisen
> and avoiding setting the regs or other pointer values on the
> chips to avoid rather deferences to a NULL pointer by other
> functions in this gpio driver.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/gpio/gpio-davinci.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index ec58f42..800227e 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -257,6 +257,8 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>                 spin_lock_init(&chips[i].lock);
>
>                 regs = gpio2regs(base);
> +               if (!ret)
> +                       return -ENXIO;

You haven't even tried to compile this one, have you?

       reply	other threads:[~2016-02-02 23:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1454015092-11416-1-git-send-email-xerofoify@gmail.com>
2016-02-02 23:30 ` Alexandre Courbot [this message]
     [not found]   ` <56B14566.5070409@gmail.com>
2016-02-03  0:27     ` [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe Alexandre Courbot
     [not found] <1454458679-11165-1-git-send-email-xerofoify@gmail.com>
2016-02-03  0:28 ` Alexandre Courbot
2016-02-15 13:38 ` Linus Walleij

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=CAAVeFuKwZ7r_8weyMWY4NrjREWaefzUWhVbh_V75FiJsWs5QMA@mail.gmail.com \
    --to=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xerofoify@gmail.com \
    /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).