Skip to content

Commit

Permalink
clk: fixed-factor: Initialize clk_init_data on stack
Browse files Browse the repository at this point in the history
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" <[email protected]>
Tested-by: Geert Uytterhoeven <[email protected]>
Tested-by: Tony Lindgren <[email protected]>
Fixes: ecbf3f1 ("clk: fixed-factor: Let clk framework find parent")
Signed-off-by: Stephen Boyd <[email protected]>
  • Loading branch information
bebarino committed Apr 23, 2019
1 parent ecbf3f1 commit e4818d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/clk/clk-fixed-factor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e4818d6

Please sign in to comment.