Skip to content

Commit 2961bf3

Browse files
Li ZefanIngo Molnar
Li Zefan
authored and
Ingo Molnar
committed
trace_stat: Don't increment @pos in seq start()
It's wrong to increment @pos in stat_seq_start(). It causes some stat entries lost when reading stat file, 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: <4A418716.90209@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent c8961ec commit 2961bf3

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

kernel/trace/trace_stat.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,13 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos)
199199
mutex_lock(&session->stat_mutex);
200200

201201
/* If we are in the beginning of the file, print the headers */
202-
if (!*pos && session->ts->stat_headers) {
203-
(*pos)++;
202+
if (!*pos && session->ts->stat_headers)
204203
return SEQ_START_TOKEN;
205-
}
206204

207205
node = rb_first(&session->stat_root);
208206
for (i = 0; node && i < *pos; i++)
209207
node = rb_next(node);
210208

211-
(*pos)++;
212-
213209
return node;
214210
}
215211

0 commit comments

Comments
 (0)