summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorNadezda Lutovinova <lutovinova@ispras.ru>2021-08-11 15:32:28 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-09-30 10:07:54 +0200
commitcdfaf4752e6915a4b455ad4400133e540e4dc965 (patch)
treeee9cdc1595ba49a4899a9af44ae5f3a4595f673a /drivers
parent7e360fa0c0f3e7dd1aa8f2b574d7b461d0caf5e2 (diff)
downloadlinux-cdfaf4752e6915a4b455ad4400133e540e4dc965.tar.gz
media: s5p-mfc: Add checking to s5p_mfc_probe().
If of_device_get_match_data() return NULL,
then null pointer dereference occurs in  s5p_mfc_init_pm().
The patch adds checking if dev->variant is NULL.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 293af8e664f4..fc85e4e2d020 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1288,6 +1288,10 @@ static int s5p_mfc_probe(struct platform_device *pdev)
 	}
 
 	dev->variant = of_device_get_match_data(&pdev->dev);
+	if (!dev->variant) {
+		dev_err(&pdev->dev, "Failed to get device MFC hardware variant information\n");
+		return -ENOENT;
+	}
 
 	dev->regs_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dev->regs_base))