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

media: coda/imx-vdoa: Check for platform_get_resource() error

platform_get_resource() may fail and in this case a NULL dereference
will occur.

Prevent this from happening by returning an error on
platform_get_resource() failure.

Fixes: b0444f18e0b18abce ("[media] coda: add i.MX6 VDOA driver")

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Fabio Estevam and committed by
Mauro Carvalho Chehab
a874aabe d088c310

+2
+2
drivers/media/platform/coda/imx-vdoa.c
··· 314 314 return PTR_ERR(vdoa->regs); 315 315 316 316 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 317 + if (!res) 318 + return -EINVAL; 317 319 vdoa->irq = devm_request_threaded_irq(&pdev->dev, res->start, NULL, 318 320 vdoa_irq_handler, IRQF_ONESHOT, 319 321 "vdoa", vdoa);