All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
       [not found] <CGME20170130045353epcas2p198210c8758d8a9d35fbfcfd8d24cc072@epcas2p1.samsung.com>
@ 2017-01-30  4:53   ` Shailendra Verma
  0 siblings, 0 replies; 4+ messages in thread
From: Shailendra Verma @ 2017-01-30  4:53 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Stephen Warren, Alexandre Courbot,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	p.shailesh-Sze3O3UU22JBDgjK7y7TUQ,
	ashish.kalra-Sze3O3UU22JBDgjK7y7TUQ, 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-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 drivers/gpu/drm/tegra/sor.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 74d0540..34f032f 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -2540,6 +2540,10 @@ static int tegra_sor_probe(struct platform_device *pdev)
 	int err;
 
 	match = of_match_device(tegra_sor_of_match, &pdev->dev);
+	if (!match) {
+		dev_err(&pdev->dev, "Error: No device match found\n");
+		return -ENODEV;
+	}
 
 	sor = devm_kzalloc(&pdev->dev, sizeof(*sor), GFP_KERNEL);
 	if (!sor)
-- 
1.7.9.5

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

* [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
@ 2017-01-30  4:53   ` Shailendra Verma
  0 siblings, 0 replies; 4+ messages in thread
From: Shailendra Verma @ 2017-01-30  4:53 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Stephen Warren, Alexandre Courbot,
	dri-devel, linux-tegra, 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/gpu/drm/tegra/sor.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 74d0540..34f032f 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -2540,6 +2540,10 @@ static int tegra_sor_probe(struct platform_device *pdev)
 	int err;
 
 	match = of_match_device(tegra_sor_of_match, &pdev->dev);
+	if (!match) {
+		dev_err(&pdev->dev, "Error: No device match found\n");
+		return -ENODEV;
+	}
 
 	sor = devm_kzalloc(&pdev->dev, sizeof(*sor), GFP_KERNEL);
 	if (!sor)
-- 
1.7.9.5

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

* Re: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
  2017-01-30  4:53   ` Shailendra Verma
@ 2017-01-30  7:11       ` Thierry Reding
  -1 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2017-01-30  7:11 UTC (permalink / raw)
  To: Shailendra Verma
  Cc: David Airlie, Stephen Warren, Alexandre Courbot,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	p.shailesh-Sze3O3UU22JBDgjK7y7TUQ,
	ashish.kalra-Sze3O3UU22JBDgjK7y7TUQ, Shailendra Verma

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

On Mon, Jan 30, 2017 at 10:23:45AM +0530, 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-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  drivers/gpu/drm/tegra/sor.c |    4 ++++
>  1 file changed, 4 insertions(+)

No, this will never happen on Tegra. If you reach the ->probe() function
this pointer is guaranteed to be non-NULL.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
@ 2017-01-30  7:11       ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2017-01-30  7:11 UTC (permalink / raw)
  To: Shailendra Verma
  Cc: David Airlie, Stephen Warren, Alexandre Courbot, dri-devel,
	linux-tegra, linux-kernel, p.shailesh, ashish.kalra,
	Shailendra Verma

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

On Mon, Jan 30, 2017 at 10:23:45AM +0530, 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/gpu/drm/tegra/sor.c |    4 ++++
>  1 file changed, 4 insertions(+)

No, this will never happen on Tegra. If you reach the ->probe() function
this pointer is guaranteed to be non-NULL.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170130045353epcas2p198210c8758d8a9d35fbfcfd8d24cc072@epcas2p1.samsung.com>
2017-01-30  4:53 ` [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence Shailendra Verma
2017-01-30  4:53   ` Shailendra Verma
     [not found]   ` <1485752025-29465-1-git-send-email-shailendra.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-01-30  7:11     ` Thierry Reding
2017-01-30  7:11       ` Thierry Reding

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.