From 183b03657cd0d415f9c6c69f2cacdd592cedaa88 Mon Sep 17 00:00:00 2001 From: Prateek Patel Date: Mon, 25 Apr 2022 07:05:41 +0000 Subject: [PATCH] drivers: dce: fix cert_c defect Dereferencing match, which could be NULL. Add a sanity check before using it. CID 451824 Bug 3512545 Change-Id: I367274508d331f602763a38ad7b1d26c2e876179 Signed-off-by: Prateek Patel Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2702272 Reviewed-by: svcacv Reviewed-by: svc_kernel_abi Reviewed-by: Sachin Nikam GVS: Gerrit_Virtual_Submit --- drivers/platform/tegra/dce/dce-module.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/platform/tegra/dce/dce-module.c b/drivers/platform/tegra/dce/dce-module.c index 15ddaa17..89423e9e 100644 --- a/drivers/platform/tegra/dce/dce-module.c +++ b/drivers/platform/tegra/dce/dce-module.c @@ -189,6 +189,11 @@ static int tegra_dce_probe(struct platform_device *pdev) const struct of_device_id *match = NULL; match = of_match_device(tegra_dce_of_match, dev); + if (!match) { + dev_info(dev, "no device match found\n"); + return -ENODEV; + } + pdata = (struct dce_platform_data *)match->data; WARN_ON(!pdata);