From: Stephen Boyd Date: Tue, 23 Apr 2019 17:46:51 +0000 (-0700) Subject: clk: fixed-factor: Initialize clk_init_data on stack X-Git-Tag: v5.2-rc1~23^2~1^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e4818d615b58f145ace70fefa43aeae8611b55a1;p=tomoyo%2Ftomoyo-test1.git clk: fixed-factor: Initialize clk_init_data on stack This structure can be full of junk from the stack if we don't initialize it. The clk framework tests clk_init_data::parent_names for non-NULL and then considers that as the parent name pointer, but if it's full of junk then we'll try to deref a bad pointer and oops the system. Let's initialize the structure so that only clk_init_data::parent_names or clk_init_data::parent_data is set, and not both. Reported-by: "kernelci.org bot" Tested-by: Geert Uytterhoeven Tested-by: Tony Lindgren Fixes: ecbf3f1795fd ("clk: fixed-factor: Let clk framework find parent") Signed-off-by: Stephen Boyd --- diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 5b09f2cdb7de..2d988a7585d5 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -70,7 +70,7 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np, unsigned long flags, unsigned int mult, unsigned int div) { struct clk_fixed_factor *fix; - struct clk_init_data init; + struct clk_init_data init = { }; struct clk_parent_data pdata = { .index = index }; struct clk_hw *hw; int ret;