Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nadezda Lutovinova and committed by
Mauro Carvalho Chehab
cdfaf475 7e360fa0

+4
+4
drivers/media/platform/s5p-mfc/s5p_mfc.c
··· 1288 1288 } 1289 1289 1290 1290 dev->variant = of_device_get_match_data(&pdev->dev); 1291 + if (!dev->variant) { 1292 + dev_err(&pdev->dev, "Failed to get device MFC hardware variant information\n"); 1293 + return -ENOENT; 1294 + } 1291 1295 1292 1296 dev->regs_base = devm_platform_ioremap_resource(pdev, 0); 1293 1297 if (IS_ERR(dev->regs_base))