* [PATCH] pinctrl: baytrail: Fix potential NULL pointer dereference
@ 2019-03-12 15:05 Aditya Pakki
2019-03-12 15:37 ` Andy Shevchenko
2019-03-18 9:57 ` Andy Shevchenko
0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-03-12 15:05 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Mika Westerberg, Andy Shevchenko, Linus Walleij,
linux-gpio, linux-kernel
saved-context in byt_gpio_probe is allocated via devm_kcalloc and is
used without checking for NULL in later functions. This patch avoids
such a scenario.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/pinctrl/intel/pinctrl-baytrail.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 241384ead4ed..18d9ad504194 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1710,6 +1710,8 @@ static int byt_gpio_probe(struct byt_gpio *vg)
#ifdef CONFIG_PM_SLEEP
vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio,
sizeof(*vg->saved_context), GFP_KERNEL);
+ if (!vg->saved_context)
+ return -ENOMEM;
#endif
ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg);
if (ret) {
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: baytrail: Fix potential NULL pointer dereference
2019-03-12 15:05 [PATCH] pinctrl: baytrail: Fix potential NULL pointer dereference Aditya Pakki
@ 2019-03-12 15:37 ` Andy Shevchenko
2019-03-18 9:57 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-03-12 15:37 UTC (permalink / raw)
To: Aditya Pakki
Cc: kjlu, Mika Westerberg, Linus Walleij, linux-gpio, linux-kernel
On Tue, Mar 12, 2019 at 10:05:52AM -0500, Aditya Pakki wrote:
> saved-context in byt_gpio_probe is allocated via devm_kcalloc and is
> used without checking for NULL in later functions. This patch avoids
> such a scenario.
>
Thanks.
I take it to our branch after merge window will be finished.
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/pinctrl/intel/pinctrl-baytrail.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
> index 241384ead4ed..18d9ad504194 100644
> --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
> @@ -1710,6 +1710,8 @@ static int byt_gpio_probe(struct byt_gpio *vg)
> #ifdef CONFIG_PM_SLEEP
> vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio,
> sizeof(*vg->saved_context), GFP_KERNEL);
> + if (!vg->saved_context)
> + return -ENOMEM;
> #endif
> ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg);
> if (ret) {
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: baytrail: Fix potential NULL pointer dereference
2019-03-12 15:05 [PATCH] pinctrl: baytrail: Fix potential NULL pointer dereference Aditya Pakki
2019-03-12 15:37 ` Andy Shevchenko
@ 2019-03-18 9:57 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-03-18 9:57 UTC (permalink / raw)
To: Aditya Pakki
Cc: kjlu, Mika Westerberg, Linus Walleij, linux-gpio, linux-kernel
On Tue, Mar 12, 2019 at 10:05:52AM -0500, Aditya Pakki wrote:
> saved-context in byt_gpio_probe is allocated via devm_kcalloc and is
> used without checking for NULL in later functions. This patch avoids
> such a scenario.
Pushed to my review and testing queue, thanks!
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/pinctrl/intel/pinctrl-baytrail.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
> index 241384ead4ed..18d9ad504194 100644
> --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
> @@ -1710,6 +1710,8 @@ static int byt_gpio_probe(struct byt_gpio *vg)
> #ifdef CONFIG_PM_SLEEP
> vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio,
> sizeof(*vg->saved_context), GFP_KERNEL);
> + if (!vg->saved_context)
> + return -ENOMEM;
> #endif
> ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg);
> if (ret) {
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-18 9:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12 15:05 [PATCH] pinctrl: baytrail: Fix potential NULL pointer dereference Aditya Pakki
2019-03-12 15:37 ` Andy Shevchenko
2019-03-18 9:57 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.