Skip to content

Commit

Permalink
ftrace: Add warning if tramp hash does not match nr_trampolines
Browse files Browse the repository at this point in the history
After adding all the records to the tramp_hash, add a check that makes
sure that the number of records added matches the number of records
expected to match and do a WARN_ON and disable ftrace if they do
not match.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt (Red Hat) committed Jul 24, 2014
1 parent 2a0343b commit dc6f03f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2226,6 +2226,9 @@ static int ftrace_save_ops_tramp_hash(struct ftrace_ops *ops)
}
} while_for_each_ftrace_rec();

/* The number of recs in the hash must match nr_trampolines */
FTRACE_WARN_ON(ops->tramp_hash->count != ops->nr_trampolines);

return 0;
}

Expand Down

0 comments on commit dc6f03f

Please sign in to comment.