aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorVasily Averin <vvs@virtuozzo.com>2020-01-24 10:03:01 +0300
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-01-30 09:46:27 -0500
commit039958a5f7aad695d4d52683c7d48aa13fb18249 (patch)
tree2abfc0f938e70c7b7a9a8d7e59babb44092c33ef /kernel/trace
parentftrace: fpid_next() should increase position index (diff)
downloadlinux-dev-039958a5f7aad695d4d52683c7d48aa13fb18249.tar.xz
linux-dev-039958a5f7aad695d4d52683c7d48aa13fb18249.zip
tracing: eval_map_next() should always increase position index
if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output. Link: http://lkml.kernel.org/r/7ad85b22-1866-977c-db17-88ac438bc764@virtuozzo.com Signed-off-by: Vasily Averin <vvs@virtuozzo.com> [ 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) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 6a28b1b9bf42..8d144fd94aa8 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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;