m68k: let clk_enable() return immediately if clk is NULL
Subsystems (2)
PATCH 1/1 m68k: let clk_enable() return immediately if clk is NULL
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.
--- arch/m68k/coldfire/clk.c | 3 +++ 1 file changed, 3 insertions(+)
arch/m68k/coldfire/clk.c +3 -0
@@ -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);
Signature · 1 line
2.7.4
Geert Uytterhoeven
maintainerHi Defang,
Quoted 4 lines · Defang Bo
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 <[email protected]>
Thanks for your patch!
arch/m68k/coldfire/clk.c EXPORT_SYMBOL(clk_get); · line 92
Quoted 6 lines
arch/m68k/coldfire/clk.c +0
-0@@ -90,6 +90,9 @@ EXPORT_SYMBOL(clk_get);int clk_enable (struct clk *clk) {unsigned long flags;
Please keep the blank line between variable declarations and statements (no complaint from scripts/checkpatch.pl? See Documentation/process/submitting-patches.rst
).
arch/m68k/coldfire/clk.c EXPORT_SYMBOL(clk_get); · line 98
Quoted 6 lines
arch/m68k/coldfire/clk.c +3
-0+if (!clk) +return -EINVAL ; +spin_lock_irqsave (&clk_lock, flags);if ((clk->enabled++ ==0 ) && clk->clk_ops) clk->clk_ops->enable (clk);
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Greg Ungerer
maintainerHi Defang,
Quoted 4 lines · Defang Bo
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 <[email protected]>
I have applied this to the m68knommu git tree, for-next branch - with blank line added as per Geert's suggestion.
Regards
Greg
Quoted 19 lines
--- arch/m68k/coldfire/clk.c | 3 +++ 1 file changed, 3 insertions(+)arch/m68k/coldfire/clk.c +3
-0@@ -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);