* [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
[not found] <CGME20170130045353epcas2p198210c8758d8a9d35fbfcfd8d24cc072@epcas2p1.samsung.com>
@ 2017-01-30 4:53 ` Shailendra Verma
2017-01-30 7:11 ` Thierry Reding
0 siblings, 1 reply; 2+ 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] 2+ messages in thread
* Re: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
2017-01-30 4:53 ` [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence Shailendra Verma
@ 2017-01-30 7:11 ` Thierry Reding
0 siblings, 0 replies; 2+ 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] 2+ messages in thread
end of thread, other threads:[~2017-01-30 7:11 UTC | newest]
Thread overview: 2+ 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 7:11 ` Thierry Reding
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).