[PATCH] clkdev: fix potential NULL pointer dereference

Russell King (Oracle) linux at armlinux.org.uk
Tue May 7 10:58:16 PDT 2024


On Tue, May 07, 2024 at 05:42:45PM +0100, André Draszik wrote:
> 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.

Good point. I'll fix the patch myself, merging the fix in.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list