[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b25c59ef-0762-a474-3c3e-b07b4fbd5f74@xs4all.nl>
Date: Thu, 28 Mar 2019 16:30:16 +0100
From: Hans Verkuil <hverkuil@...all.nl>
To: Kangjie Lu <kjlu@....edu>
Cc: pakki001@....edu, Jacopo Mondi <jacopo@...ndi.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: renesas-ceu: fix a potential NULL pointer
dereference
On 3/9/19 8:14 AM, Kangjie Lu wrote:
> In case of_match_device cannot find a match, the check returns
> -EINVAL to avoid a potential NULL pointer dereference
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
> drivers/media/platform/renesas-ceu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c
> index 150196f7cf96..4aa807c0b6c7 100644
> --- a/drivers/media/platform/renesas-ceu.c
> +++ b/drivers/media/platform/renesas-ceu.c
> @@ -1682,7 +1682,10 @@ static int ceu_probe(struct platform_device *pdev)
>
> if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
> ceu_data = of_match_device(ceu_of_match, dev)->data;
> - num_subdevs = ceu_parse_dt(ceudev);
A far as I can tell ceu_parse_dt will never return 0.
I'm dropping this patch.
Regards,
Hans
> + if (unlikely(!ceu_data))
> + num_subdevs = -EINVAL;
> + else
> + num_subdevs = ceu_parse_dt(ceudev);
> } else if (dev->platform_data) {
> /* Assume SH4 if booting with platform data. */
> ceu_data = &ceu_data_sh4;
>
Powered by blists - more mailing lists