Message ID | 1502928847-10464-1-git-send-email-festevam@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Fabio, On Wed, 2017-08-16 at 21:14 -0300, Fabio Estevam wrote: > > From: Fabio Estevam <fabio.estevam@nxp.com> > > 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> > --- > drivers/media/platform/coda/imx-vdoa.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platform/coda/imx-vdoa.c > index df9b716..8eb3e0c 100644 > --- a/drivers/media/platform/coda/imx-vdoa.c > +++ b/drivers/media/platform/coda/imx-vdoa.c > @@ -314,6 +314,8 @@ static int vdoa_probe(struct platform_device *pdev) > > return PTR_ERR(vdoa->regs); > > > res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > > + if (!res) > > + return -EINVAL; > > vdoa->irq = devm_request_threaded_irq(&pdev->dev, res->start, NULL, > > vdoa_irq_handler, IRQF_ONESHOT, > > "vdoa", vdoa); Thank you for the fix! I think it would be better to replace platform_get_resource with platform_get_irq. Either way, Acked-by: Philipp Zabel <p.zabel@pengutronix.de> regards Philipp
diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platform/coda/imx-vdoa.c index df9b716..8eb3e0c 100644 --- a/drivers/media/platform/coda/imx-vdoa.c +++ b/drivers/media/platform/coda/imx-vdoa.c @@ -314,6 +314,8 @@ static int vdoa_probe(struct platform_device *pdev) return PTR_ERR(vdoa->regs); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) + return -EINVAL; vdoa->irq = devm_request_threaded_irq(&pdev->dev, res->start, NULL, vdoa_irq_handler, IRQF_ONESHOT, "vdoa", vdoa);