Skip to content

Commit c8961ec

Browse files
Li ZefanIngo Molnar
Li Zefan
authored and
Ingo Molnar
committed
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: Lai Jiangshan <laijs@cn.fujitsu.com> 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: <4A4186FA.1020106@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent e1c7e2a commit c8961ec

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

kernel/trace/trace_printk.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -155,25 +155,19 @@ int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap)
155155
EXPORT_SYMBOL_GPL(__ftrace_vprintk);
156156

157157
static void *
158-
t_next(struct seq_file *m, void *v, loff_t *pos)
158+
t_start(struct seq_file *m, loff_t *pos)
159159
{
160-
const char **fmt = m->private;
161-
const char **next = fmt;
162-
163-
(*pos)++;
160+
const char **fmt = __start___trace_bprintk_fmt + *pos;
164161

165162
if ((unsigned long)fmt >= (unsigned long)__stop___trace_bprintk_fmt)
166163
return NULL;
167-
168-
next = fmt;
169-
m->private = ++next;
170-
171164
return fmt;
172165
}
173166

174-
static void *t_start(struct seq_file *m, loff_t *pos)
167+
static void *t_next(struct seq_file *m, void * v, loff_t *pos)
175168
{
176-
return t_next(m, NULL, pos);
169+
(*pos)++;
170+
return t_start(m, pos);
177171
}
178172

179173
static int t_show(struct seq_file *m, void *v)
@@ -224,15 +218,7 @@ static const struct seq_operations show_format_seq_ops = {
224218
static int
225219
ftrace_formats_open(struct inode *inode, struct file *file)
226220
{
227-
int ret;
228-
229-
ret = seq_open(file, &show_format_seq_ops);
230-
if (!ret) {
231-
struct seq_file *m = file->private_data;
232-
233-
m->private = __start___trace_bprintk_fmt;
234-
}
235-
return ret;
221+
return seq_open(file, &show_format_seq_ops);
236222
}
237223

238224
static const struct file_operations ftrace_formats_fops = {

0 commit comments

Comments
 (0)