lkml.org 
[lkml]   [2024]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] clkdev: fix potential NULL pointer dereference
From
Date
Hi Marek,

On Tue, 2024-05-07 at 08:44 +0200, Marek Szyprowski wrote:
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index ddacab7863d0..d2801ae70e34 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -194,10 +194,12 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
>   return &cla->cl;
>  
>  fail:
> - fmt.fmt = dev_fmt;
> - fmt.va = &ap_copy;
> - pr_err("%pV:%s: %s ID is greater than %zu\n",
> -        &fmt, con_id, failure, max_size);
> + if (dev_fmt) {
> + fmt.fmt = dev_fmt;
> + fmt.va = &ap_copy;
> + pr_err("%pV:%s: %s ID is greater than %zu\n",
> +        &fmt, con_id, failure, max_size);
> + }

It might be nice to still print the rest of the error, so it's easier to see which
clock is causing trouble.

Cheers,
Andre'


\
 
 \ /
  Last update: 2024-05-27 18:19    [W:0.100 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site