[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <963a69d9-34ac-085b-3756-95cc376fb7ca@linux-m68k.org>
Date: Mon, 25 Jan 2021 23:24:45 +1000
From: Greg Ungerer <gerg@...ux-m68k.org>
To: Defang Bo <bodefang@....com>, geert@...ux-m68k.org
Cc: linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] m68k: let clk_enable() return immediately if clk is NULL
Hi Defang,
On 28/12/20 12:07 pm, Defang Bo wrote:
> Similar to commit<742859adc721>("m68k: let clk_disable() return immediately if clk is NULL").
> there should be a check for clk to prevent NULL pointer dereference.
>
> Signed-off-by: Defang Bo <bodefang@....com>
I have applied this to the m68knommu git tree, for-next branch -
with blank line added as per Geert's suggestion.
Regards
Greg
> ---
> arch/m68k/coldfire/clk.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
> index 7bc666e..6decd11 100644
> --- a/arch/m68k/coldfire/clk.c
> +++ b/arch/m68k/coldfire/clk.c
> @@ -90,6 +90,9 @@ EXPORT_SYMBOL(clk_get);
> int clk_enable(struct clk *clk)
> {
> unsigned long flags;
> + if (!clk)
> + return -EINVAL;
> +
> spin_lock_irqsave(&clk_lock, flags);
> if ((clk->enabled++ == 0) && clk->clk_ops)
> clk->clk_ops->enable(clk);
>
Powered by blists - more mailing lists