提交 b28d7b2d 编写于 作者: D Dan Carpenter 提交者: Steven Rostedt (VMware)

tracing: Uninitialized variable in create_tracing_map_fields()

Smatch complains that idx can be used uninitialized when we check if
(idx < 0).  It has to be the first iteration through the loop and the
HIST_FIELD_FL_STACKTRACE bit has to be clear and the HIST_FIELD_FL_VAR
bit has to be set to reach the bug.

Link: http://lkml.kernel.org/r/20180328114815.GC29050@mwanda

Fixes: 30350d65 ("tracing: Add variable support to hist triggers")
Acked-by: NTom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
上级 ad452870
...@@ -4458,7 +4458,7 @@ static int create_tracing_map_fields(struct hist_trigger_data *hist_data) ...@@ -4458,7 +4458,7 @@ static int create_tracing_map_fields(struct hist_trigger_data *hist_data)
struct tracing_map *map = hist_data->map; struct tracing_map *map = hist_data->map;
struct ftrace_event_field *field; struct ftrace_event_field *field;
struct hist_field *hist_field; struct hist_field *hist_field;
int i, idx; int i, idx = 0;
for_each_hist_field(i, hist_data) { for_each_hist_field(i, hist_data) {
hist_field = hist_data->fields[i]; hist_field = hist_data->fields[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册