[PATCH 2/7] gcov_seq_next should increase position index

From: Vasily Averin
Date: Fri Jan 24 2020 - 02:03:30 EST


if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx>
---
kernel/gcov/fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
index e5eb5ea..cc4ee48 100644
--- a/kernel/gcov/fs.c
+++ b/kernel/gcov/fs.c
@@ -108,9 +108,9 @@ static void *gcov_seq_next(struct seq_file *seq, void *data, loff_t *pos)
{
struct gcov_iterator *iter = data;

+ (*pos)++;
if (gcov_iter_next(iter))
return NULL;
- (*pos)++;

return iter;
}
--
1.8.3.1