lkml.org 
[lkml]   [2019]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] media: vpss: fix a potential NULL pointer dereference
From
Date

On 3/23/2019 8:21 AM, Kangjie Lu wrote:
> In case ioremap fails, the fix returns -ENOMEM to avoid NULL
> pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>


Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

-Mukesh

> ---
> drivers/media/platform/davinci/vpss.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> 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);
>

\
 
 \ /
  Last update: 2019-03-27 13:59    [W:0.053 / U:6.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site