Commit d50c744e authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracing: Fix unsigned comparison to zero in hist trigger code

Fengguang Wu's bot found two comparisons of unsigned integers to zero. These
were real bugs, as it would miss error conditions returned to zero.

trace_events_hist.c:426:6-9: WARNING: Unsigned expression compared with zero: idx < 0
trace_events_hist.c:568:5-14: WARNING: Unsigned expression compared with zero: n_entries < 0
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 93c5f671
...@@ -734,7 +734,7 @@ static int create_tracing_map_fields(struct hist_trigger_data *hist_data) ...@@ -734,7 +734,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;
unsigned int i, idx; int i, idx;
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];
...@@ -1036,7 +1036,7 @@ static int print_entries(struct seq_file *m, ...@@ -1036,7 +1036,7 @@ static int print_entries(struct seq_file *m,
{ {
struct tracing_map_sort_entry **sort_entries = NULL; struct tracing_map_sort_entry **sort_entries = NULL;
struct tracing_map *map = hist_data->map; struct tracing_map *map = hist_data->map;
unsigned int i, n_entries; int i, n_entries;
n_entries = tracing_map_sort_entries(map, hist_data->sort_keys, n_entries = tracing_map_sort_entries(map, hist_data->sort_keys,
hist_data->n_sort_keys, hist_data->n_sort_keys,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment