From ad82a5e52a5fca01fab87fbd55e0aab230e2573c Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 3 Oct 2023 11:11:42 -0700 Subject: [PATCH] Squelch warning from bpf_iter.c. v5.7-rc2-1174-gfd4f12bc38c3 significantly rewrites the bpf iterator which hits this _next() function. It also adds a check that verifies that the *pos is incremented after every call, even if it goes beyond the last member (in which case it's not used). Signed-off-by: Auke Kok --- kmod/src/tseq.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kmod/src/tseq.c b/kmod/src/tseq.c index b4b07f34..2621406f 100644 --- a/kmod/src/tseq.c +++ b/kmod/src/tseq.c @@ -183,6 +183,13 @@ static void *scoutfs_tseq_seq_next(struct seq_file *m, void *v, loff_t *pos) ent = tseq_rb_next(ent); if (ent) *pos = ent->pos; + else + /* + * once we hit the end, *pos is never used, but it has to + * be updated to avoid an error in bpf_seq_read() + */ + (*pos)++; + return ent; }