Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1569388 > unrolled thread

[PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.

Started byShailendra Verma <shailendra.v@samsung.com>
First post2017-01-30 06:00 +0100
Last post2017-01-30 08:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-30 06:00 +0100
    Re: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence. Thierry Reding <thierry.reding@gmail.com> - 2017-01-30 08:20 +0100

#1569388 — [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.

FromShailendra Verma <shailendra.v@samsung.com>
Date2017-01-30 06:00 +0100
Subject[PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
Message-ID<t5cem-804-17@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1569434

FromThierry Reding <thierry.reding@gmail.com>
Date2017-01-30 08:20 +0100
Message-ID<t5epP-15B-5@gated-at.bofh.it>
In reply to#1569388

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web