From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: "kjlu@umn.edu" <kjlu@umn.edu>,
Linus Walleij <linus.walleij@linaro.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: berlin: as370: Fix to avoid NULL pointer dereference
Date: Tue, 19 Mar 2019 05:30:46 +0000 [thread overview]
Message-ID: <20190319132319.098c5fa3@xhacker.debian> (raw)
In-Reply-To: <20190318233734.9991-1-pakki001@umn.edu>
On Mon, 18 Mar 2019 18:37:27 -0500 Aditya Pakki wrote:
>
>
> of_match_device in as370_pinctrl_probe can return a NULL value
> when the matching device is not found. The patch avoids a potential
Similar as the comment to your previous patch, this could not happen.
If the probe is called, it means OF registered a device with a valid
compatible string, so match cannot be NULL.
> dereference in such scenario.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/pinctrl/berlin/pinctrl-as370.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pinctrl/berlin/pinctrl-as370.c b/drivers/pinctrl/berlin/pinctrl-as370.c
> index 44f8ccdbeeff..78bb5b866c99 100644
> --- a/drivers/pinctrl/berlin/pinctrl-as370.c
> +++ b/drivers/pinctrl/berlin/pinctrl-as370.c
> @@ -337,6 +337,8 @@ static int as370_pinctrl_probe(struct platform_device *pdev)
> struct resource *res;
> void __iomem *base;
>
> + if (!match)
> + return -ENODEV;
> rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL);
> if (!rmconfig)
> return -ENOMEM;
> --
> 2.17.1
>
prev parent reply other threads:[~2019-03-19 5:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 23:37 [PATCH] pinctrl: berlin: as370: Fix to avoid NULL pointer dereference Aditya Pakki
2019-03-19 5:30 ` Jisheng Zhang [this message]
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=20190319132319.098c5fa3@xhacker.debian \
--to=jisheng.zhang@synaptics.com \
--cc=kjlu@umn.edu \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pakki001@umn.edu \
/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).