Messages in this thread Patch in this message | | | From | Shailendra Verma <> | Subject | [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence. | Date | Mon, 30 Jan 2017 10:23:45 +0530 |
| |
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
| |