All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Mmc: host - Fix possible NULL derefrence.
       [not found] <CGME20170130044838epcas1p43a1c58ae970b39909cfb67b2aa619a88@epcas1p4.samsung.com>
@ 2017-01-30  4:48 ` Shailendra Verma
  2017-01-30 12:12   ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Shailendra Verma @ 2017-01-30  4:48 UTC (permalink / raw)
  To: Ulf Hansson, Fabio Estevam, Marek Vasut, linux-mmc, linux-kernel,
	p.shailesh, ashish.kalra, Shailendra Verma, Shailendra Verma

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;
+	}
+
 	irq_err = platform_get_irq(pdev, 0);
 	if (irq_err < 0)
 		return irq_err;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Mmc: host - Fix possible NULL derefrence.
  2017-01-30  4:48 ` [PATCH] Mmc: host - Fix possible NULL derefrence Shailendra Verma
@ 2017-01-30 12:12   ` Marek Vasut
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2017-01-30 12:12 UTC (permalink / raw)
  To: Shailendra Verma, Ulf Hansson, Fabio Estevam, linux-mmc,
	linux-kernel, p.shailesh, ashish.kalra, Shailendra Verma

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-30 12:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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 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.