From: Marek Vasut <marex@denx.de>
To: Shailendra Verma <shailendra.v@samsung.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Fabio Estevam <fabio.estevam@nxp.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
p.shailesh@samsung.com, ashish.kalra@samsung.com,
Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: Re: [PATCH] Mmc: host - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 13:12:58 +0100 [thread overview]
Message-ID: <7439833a-e8cd-54b5-a020-4a16ac2d75a8@denx.de> (raw)
In-Reply-To: <1485751698-29036-1-git-send-email-shailendra.v@samsung.com>
On 01/30/2017 05:48 AM, Shailendra Verma wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
> drivers/mmc/host/mxs-mmc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> index 44ecebd..d12a5b7 100644
> --- a/drivers/mmc/host/mxs-mmc.c
> +++ b/drivers/mmc/host/mxs-mmc.c
> @@ -581,6 +581,11 @@ static int mxs_mmc_probe(struct platform_device *pdev)
> struct regulator *reg_vmmc;
> struct mxs_ssp *ssp;
>
> + if (!of_id) {
> + dev_err(&pdev->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
The probe won't be called if OF match doesn't happen in the first place,
so this check is redundant, no ?
> irq_err = platform_get_irq(pdev, 0);
> if (irq_err < 0)
> return irq_err;
>
--
Best regards,
Marek Vasut
prev parent reply other threads:[~2017-01-30 12:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170130044838epcas1p43a1c58ae970b39909cfb67b2aa619a88@epcas1p4.samsung.com>
2017-01-30 4:48 ` [PATCH] Mmc: host - Fix possible NULL derefrence Shailendra Verma
2017-01-30 12:12 ` Marek Vasut [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=7439833a-e8cd-54b5-a020-4a16ac2d75a8@denx.de \
--to=marex@denx.de \
--cc=ashish.kalra@samsung.com \
--cc=fabio.estevam@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=p.shailesh@samsung.com \
--cc=shailendra.capricorn@gmail.com \
--cc=shailendra.v@samsung.com \
--cc=ulf.hansson@linaro.org \
/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).