* Re: [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe
[not found] <1454015092-11416-1-git-send-email-xerofoify@gmail.com>
@ 2016-02-02 23:30 ` Alexandre Courbot
[not found] ` <56B14566.5070409@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Courbot @ 2016-02-02 23:30 UTC (permalink / raw)
To: Nicholas Krause
Cc: Linus Walleij, linux-gpio@vger.kernel.org,
Linux Kernel Mailing List
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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe
[not found] ` <56B14566.5070409@gmail.com>
@ 2016-02-03 0:27 ` Alexandre Courbot
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Courbot @ 2016-02-03 0:27 UTC (permalink / raw)
To: nick; +Cc: Linus Walleij, linux-gpio@vger.kernel.org,
Linux Kernel Mailing List
On Wed, Feb 3, 2016 at 9:10 AM, nick <xerofoify@gmail.com> wrote:
>
>
> On 2016-02-02 06:30 PM, Alexandre Courbot wrote:
>> 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?
>>
> Weird my compiler didn't fail when building with allmodconfig on x86_64 unless this
> driver is not enabled by default under that build config it should have failed.
> Sorry about that Alexandre I will resend and fix up that build issue.
Davinci is ARM, so it will not be included in a x86 build.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe
[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
1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Courbot @ 2016-02-03 0:28 UTC (permalink / raw)
To: Nicholas Krause
Cc: Linus Walleij, linux-gpio@vger.kernel.org,
Linux Kernel Mailing List
On Wed, Feb 3, 2016 at 9:17 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
>
> 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..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@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe
[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
1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-02-15 13:38 UTC (permalink / raw)
To: Nicholas Krause
Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Wed, Feb 3, 2016 at 1:17 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
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Patch applied with Alex' review tag.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-15 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1454015092-11416-1-git-send-email-xerofoify@gmail.com>
2016-02-02 23:30 ` [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe Alexandre Courbot
[not found] ` <56B14566.5070409@gmail.com>
2016-02-03 0:27 ` 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
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).