[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+V-a8tQMOjoWeBr==KW_7waQHMqG7x4FCVqMkVr3Hjy9cZe5A@mail.gmail.com>
Date: Tue, 26 Mar 2019 09:46:16 +0000
From: "Lad, Prabhakar" <prabhakar.csengg@...il.com>
To: Kangjie Lu <kjlu@....edu>
Cc: pakki001@....edu, Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media <linux-media@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: vpss: fix a potential NULL pointer dereference
Hi Kangjie,
Thanks for the patch.
On Sat, Mar 23, 2019 at 2:51 AM Kangjie Lu <kjlu@....edu> wrote:
>
> In case ioremap fails, the fix returns -ENOMEM to avoid NULL
> pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
> drivers/media/platform/davinci/vpss.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
Acked-by: Lad, Prabhakar <prabhakar.csengg@...il.com>
Cheers,
--Prabhakar Lad
> diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
> index 19cf6853411e..89a86c19579b 100644
> --- a/drivers/media/platform/davinci/vpss.c
> +++ b/drivers/media/platform/davinci/vpss.c
> @@ -518,6 +518,11 @@ static int __init vpss_init(void)
> return -EBUSY;
>
> oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
> + if (unlikely(!oper_cfg.vpss_regs_base2)) {
> + release_mem_region(VPSS_CLK_CTRL, 4);
> + return -ENOMEM;
> + }
> +
> writel(VPSS_CLK_CTRL_VENCCLKEN |
> VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
>
> --
> 2.17.1
>
Powered by blists - more mailing lists