Commit c8961ec6 authored by Li Zefan's avatar Li Zefan Committed by Ingo Molnar

tracing_bprintk: Don't increment @pos in t_start()

It's wrong to increment @pos in t_start(), otherwise we'll lose
some entries when reading printk_formats, if the output is larger
than PAGE_SIZE.
Reported-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Reviewed-by: default avatarLiming Wang <liming.wang@windriver.com>
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A4186FA.1020106@cn.fujitsu.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e1c7e2a6
...@@ -155,25 +155,19 @@ int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap) ...@@ -155,25 +155,19 @@ int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap)
EXPORT_SYMBOL_GPL(__ftrace_vprintk); EXPORT_SYMBOL_GPL(__ftrace_vprintk);
static void * static void *
t_next(struct seq_file *m, void *v, loff_t *pos) t_start(struct seq_file *m, loff_t *pos)
{ {
const char **fmt = m->private; const char **fmt = __start___trace_bprintk_fmt + *pos;
const char **next = fmt;
(*pos)++;
if ((unsigned long)fmt >= (unsigned long)__stop___trace_bprintk_fmt) if ((unsigned long)fmt >= (unsigned long)__stop___trace_bprintk_fmt)
return NULL; return NULL;
next = fmt;
m->private = ++next;
return fmt; return fmt;
} }
static void *t_start(struct seq_file *m, loff_t *pos) static void *t_next(struct seq_file *m, void * v, loff_t *pos)
{ {
return t_next(m, NULL, pos); (*pos)++;
return t_start(m, pos);
} }
static int t_show(struct seq_file *m, void *v) static int t_show(struct seq_file *m, void *v)
...@@ -224,15 +218,7 @@ static const struct seq_operations show_format_seq_ops = { ...@@ -224,15 +218,7 @@ static const struct seq_operations show_format_seq_ops = {
static int static int
ftrace_formats_open(struct inode *inode, struct file *file) ftrace_formats_open(struct inode *inode, struct file *file)
{ {
int ret; return seq_open(file, &show_format_seq_ops);
ret = seq_open(file, &show_format_seq_ops);
if (!ret) {
struct seq_file *m = file->private_data;
m->private = __start___trace_bprintk_fmt;
}
return ret;
} }
static const struct file_operations ftrace_formats_fops = { static const struct file_operations ftrace_formats_fops = {
......
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