public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/7] gcov_seq_next should increase position index
@ 2020-01-24  7:02 Vasily Averin
  2020-01-30 13:09 ` Peter Oberparleiter
  0 siblings, 1 reply; 3+ messages in thread
From: Vasily Averin @ 2020-01-24  7:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, NeilBrown, Waiman Long, Steven Rostedt,
	Ingo Molnar, Peter Oberparleiter

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@virtuozzo.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-25  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-24  7:02 [PATCH 2/7] gcov_seq_next should increase position index Vasily Averin
2020-01-30 13:09 ` Peter Oberparleiter
2020-02-25  6:36   ` Vasily Averin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox