From: Philipp Zabel <p.zabel@pengutronix.de>
To: Fabio Estevam <festevam@gmail.com>
Cc: mchehab@kernel.org, hansverk@cisco.com,
linux-media@vger.kernel.org,
Fabio Estevam <fabio.estevam@nxp.com>
Subject: Re: [PATCH] [media] coda/imx-vdoa: Check for platform_get_resource() error
Date: Fri, 18 Aug 2017 09:43:03 +0200 [thread overview]
Message-ID: <1503042183.7730.1.camel@pengutronix.de> (raw)
In-Reply-To: <1502928847-10464-1-git-send-email-festevam@gmail.com>
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
prev parent reply other threads:[~2017-08-18 7:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 0:14 [PATCH] [media] coda/imx-vdoa: Check for platform_get_resource() error Fabio Estevam
2017-08-18 7:43 ` Philipp Zabel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1503042183.7730.1.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=fabio.estevam@nxp.com \
--cc=festevam@gmail.com \
--cc=hansverk@cisco.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox