diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-06-23 21:54:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-24 05:02:52 -0400 |
commit | 85951842a1020669f0a9eb0f0d1853b41341f097 (patch) | |
tree | 799bba3e78b7424761901dacf3290ce05b9cb9ed /kernel/trace | |
parent | f129e965bef40c6153e4fe505f1e408286213424 (diff) |
ftrace: Don't increment @pos in g_start()
It's wrong to increment @pos in g_start(). It causes some entries
lost when reading set_graph_function, if the output of the file
is larger than PAGE_SIZE.
Reviewed-by: Liming Wang <liming.wang@windriver.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A418738.7090401@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ftrace.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 3718d55fb4c3..cde74b9973b7 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -2500,32 +2500,31 @@ int ftrace_graph_count; | |||
2500 | unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS] __read_mostly; | 2500 | unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS] __read_mostly; |
2501 | 2501 | ||
2502 | static void * | 2502 | static void * |
2503 | g_next(struct seq_file *m, void *v, loff_t *pos) | 2503 | __g_next(struct seq_file *m, loff_t *pos) |
2504 | { | 2504 | { |
2505 | unsigned long *array = m->private; | 2505 | unsigned long *array = m->private; |
2506 | int index = *pos; | ||
2507 | |||
2508 | (*pos)++; | ||
2509 | 2506 | ||
2510 | if (index >= ftrace_graph_count) | 2507 | if (*pos >= ftrace_graph_count) |
2511 | return NULL; | 2508 | return NULL; |
2509 | return &array[*pos]; | ||
2510 | } | ||
2512 | 2511 | ||
2513 | return &array[index]; | 2512 | static void * |
2513 | g_next(struct seq_file *m, void *v, loff_t *pos) | ||
2514 | { | ||
2515 | (*pos)++; | ||
2516 | return __g_next(m, pos); | ||
2514 | } | 2517 | } |
2515 | 2518 | ||
2516 | static void *g_start(struct seq_file *m, loff_t *pos) | 2519 | static void *g_start(struct seq_file *m, loff_t *pos) |
2517 | { | 2520 | { |
2518 | void *p = NULL; | ||
2519 | |||
2520 | mutex_lock(&graph_lock); | 2521 | mutex_lock(&graph_lock); |
2521 | 2522 | ||
2522 | /* Nothing, tell g_show to print all functions are enabled */ | 2523 | /* Nothing, tell g_show to print all functions are enabled */ |
2523 | if (!ftrace_graph_count && !*pos) | 2524 | if (!ftrace_graph_count && !*pos) |
2524 | return (void *)1; | 2525 | return (void *)1; |
2525 | 2526 | ||
2526 | p = g_next(m, p, pos); | 2527 | return __g_next(m, pos); |
2527 | |||
2528 | return p; | ||
2529 | } | 2528 | } |
2530 | 2529 | ||
2531 | static void g_stop(struct seq_file *m, void *p) | 2530 | static void g_stop(struct seq_file *m, void *p) |