]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ftrace: Add warning if tramp hash does not match nr_trampolines
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Thu, 24 Jul 2014 15:26:11 +0000 (11:26 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 24 Jul 2014 15:26:11 +0000 (11:26 -0400)
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>
kernel/trace/ftrace.c

index 6ef1989c2b2e16fd87e52771edf9ba41232c4d4c..979bd8cb4349588e56913e81ae89935b8c347b04 100644 (file)
@@ -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;
 }