* [PATCH 2/2] m68k: let clk_enable() return immediately if clk is NULL
@ 2020-12-27 14:35 Defang Bo
2020-12-27 15:47 ` Andreas Schwab
0 siblings, 1 reply; 2+ messages in thread
From: Defang Bo @ 2020-12-27 14:35 UTC (permalink / raw)
To: gerg, geert; +Cc: linux-m68k, linux-kernel, Defang Bo
There should be a check for clk to prevent NULL pointer dereference.
Signed-off-by: Defang Bo <bodefang@126.com>
---
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..cf1ed97 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;
+
spin_lock_irqsave(&clk_lock, flags);
if ((clk->enabled++ == 0) && clk->clk_ops)
clk->clk_ops->enable(clk);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] m68k: let clk_enable() return immediately if clk is NULL
2020-12-27 14:35 [PATCH 2/2] m68k: let clk_enable() return immediately if clk is NULL Defang Bo
@ 2020-12-27 15:47 ` Andreas Schwab
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2020-12-27 15:47 UTC (permalink / raw)
To: Defang Bo; +Cc: gerg, geert, linux-m68k, linux-kernel
On Dez 27 2020, Defang Bo wrote:
> diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
> index 7bc666e..cf1ed97 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;
That fails to return a value.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-27 15:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 14:35 [PATCH 2/2] m68k: let clk_enable() return immediately if clk is NULL Defang Bo
2020-12-27 15:47 ` Andreas Schwab
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.