[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190318095741.GO9224@smile.fi.intel.com>
Date: Mon, 18 Mar 2019 11:57:41 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Aditya Pakki <pakki001@....edu>
Cc: kjlu@....edu, Mika Westerberg <mika.westerberg@...ux.intel.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pinctrl: baytrail: Fix potential NULL pointer dereference
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@....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
Powered by blists - more mailing lists