Skip to contentSkip to conversation

pstore_ftrace_seq_next should increase position index

PATCH Superseded Vasily Averin 1 participant 1 message Jan 24, 2020 Pstore filesystem

v1 of 3 Superseded 3 of 7 applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 pstore_ftrace_seq_next should increase position index

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

---
 fs/pstore/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/inode.c +1 -1
index 7fbe8f0..ea8799b 100644
@@ -87,11 +87,11 @@ static void *pstore_ftrace_seq_next(struct seq_file *s, void *v, loff_t *pos)
 	struct pstore_private *ps = s->private;
 	struct pstore_ftrace_seq_data *data = v;
 
+	(*pos)++;
 	data->off += REC_SIZE;
 	if (data->off + REC_SIZE > ps->total_size)
 		return NULL;
 
-	(*pos)++;
 	return data;
 }
 
Signature · 1 line
1.8.3.1