[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAAVeFuKS-68h-GVP7hkyoPWo3oavTGJ40=b8w8FxD+7Pwh_rLw@mail.gmail.com>
Date: Wed, 3 Feb 2016 09:28:48 +0900
From: Alexandre Courbot <gnurou@...il.com>
To: Nicholas Krause <xerofoify@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] davinci:Fix possible NULL pointer deference in the
function davinci_gpio_probe
On Wed, Feb 3, 2016 at 9:17 AM, Nicholas Krause <xerofoify@...il.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
>
> Signed-off-by: Nicholas Krause <xerofoify@...il.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..1cc527d 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 (!regs)
> + return -ENXIO;
Ok, a bit futile maybe but this *may* happen in theory...
Reviewed-by: Alexandre Courbot <acourbot@...dia.com>
Powered by blists - more mailing lists