re: clk: actions: Don't reference clk_init_data after registration [bug report]
From: Colin Ian King
Date: Fri Aug 16 2019 - 18:31:15 EST
Hi,
Static analysis with Coverity Scan on linux-next has found an issue with
the following commit:
commit 20cac6d02815edcc0b1c87bc3e8858b3d1fda3fa
Author: Stephen Boyd <sboyd@xxxxxxxxxx>
Date: Wed Jul 31 12:35:09 2019 -0700
clk: actions: Don't reference clk_init_data after registration
The analysis is as follows:
7 int i, ret;
1. var_decl: Declaring variable hw without initializer.
68 struct clk_hw *hw;
69
2. Condition i < hw_clks->num, taking true branch.
70 for (i = 0; i < hw_clks->num; i++) {
CID 85252 (#1 of 1): Uninitialized pointer read (UNINIT)
3. uninit_use: Using uninitialized value hw.
71 const char *name = hw->init->name;
72
73 hw = hw_clks->hws[i];
hw is being dereferenced on line 71 however it is not assigned until
line 73.
Did you instead intent this to be:
const char *name;
hw = hw_clks->hws[i];
name = hw->init->name;
Colin