Skip to content

Commit

Permalink
tracing: eval_map_next() should always increase position index
Browse files Browse the repository at this point in the history
if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

Link: http://lkml.kernel.org/r/[email protected]

Signed-off-by: Vasily Averin <[email protected]>
[ This is not a bug fix, it just makes it "technically correct"
  which is why I applied it. NULL is only returned on an anomaly
  which triggers a WARN_ON ]
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
vaverin authored and rostedt committed Jan 30, 2020
1 parent e4075e8 commit 039958a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -5399,14 +5399,12 @@ static void *eval_map_next(struct seq_file *m, void *v, loff_t *pos)
* Paranoid! If ptr points to end, we don't want to increment past it.
* This really should never happen.
*/
(*pos)++;
ptr = update_eval_map(ptr);
if (WARN_ON_ONCE(!ptr))
return NULL;

ptr++;

(*pos)++;

ptr = update_eval_map(ptr);

return ptr;
Expand Down

0 comments on commit 039958a

Please sign in to comment.