Re: [PATCH v8 40/43] dyndbg: add epilogue to dynamic_debug/control file
From: sashiko-bot@kernel.org
Date: 2026-09-05 18:26:01
Also in:
dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] ddebug_proc_start() fails to return EPILOGUE_TOKEN when resuming sequence iteration at the epilogue index, which violates seq_file semantics and causes the epilogue to be silently omitted if a read boundary falls exactly before it. -- commit c254572f4a41eba87d7288c5cb6c6ef71571d0a3 Author: Jim Cromie [off-list ref] dyndbg: add epilogue to dynamic_debug/control file This commit adds an epilogue to the control-file to allow display of statistics without disturbing the header. It introduces an EPILOGUE_TOKEN yielded at the end of seq_file iteration.
quoted hunk ↗ jump to hunk
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b7ccf471b5efe..d098afe8d340f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c
[ ... ]
static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
{
struct ddebug_iter *iter = m->private;
struct _ddebug *dp;
+ (*pos)++;
+
+ if (p == EPILOGUE_TOKEN)
+ return NULL;
+
if (p == SEQ_START_TOKEN)
dp = ddebug_iter_first(iter);
else
dp = ddebug_iter_next(iter);
- ++*pos;
- return dp;
+
+ if (dp)
+ return dp;
+
+ return EPILOGUE_TOKEN;
[Severity: Medium]
Since ddebug_proc_next() now yields EPILOGUE_TOKEN as an additional sequence
element, does ddebug_proc_start() also need to be updated to handle resuming
iteration at the epilogue index?
If a read boundary falls exactly before the epilogue (where pos equals the
total number of items plus one), ddebug_proc_start() will iterate until dp
is NULL, and then return NULL instead of EPILOGUE_TOKEN:
lib/dynamic_debug.c:ddebug_proc_start() {
...
dp = ddebug_iter_first(iter);
while (dp != NULL && --n > 0)
dp = ddebug_iter_next(iter);
return dp;
}
Will this cause the epilogue to be silently omitted in that scenario?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260905-dd-cmap-part2-clean-v8-0-a4cc0674f6fd@gmail.com?part=40