> diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
> index c9c257784ee3d..5c0ec3edce720 100644
> --- a/tools/testing/selftests/bpf/veristat.c
> +++ b/tools/testing/selftests/bpf/veristat.c
[ ... ]
> @@ -1025,11 +1027,24 @@ static int parse_verif_log(char * const buf, size_t buf_sz, struct verif_stats *
> &s->stats[MARK_READ_MAX_LEN]))
> continue;
>
> + /*
> + * New kernels emit one "subprog <id> (<name>) <kind>" record
> + * per subprogram with the stack depth at the end, while old
> + * kernels emit a single "stack depth <a+...+n> max <max>"
> + * line. Match both formats so veristat works against either
> + * kernel.
> + */
> + if (sscanf(cur, "stack depth max %ld", &s->stats[MAX_STACK]) == 1)
> + continue;
> + if (sscanf(cur, "subprog %*d %*s %*s insns_self %*d insns_total %*d stack %ld", &sub_stack) == 1) {
This isn't a bug, but would it read better to keep the same N == sscanf(...)
form as the neighbouring checks in this loop, so the block stays consistent?
The pre-existing checks just above use:
if (1 == sscanf(cur, "verification time %ld usec\n", ...))
if (5 == sscanf(cur, "processed %ld insns (limit %*d) ...
and the legacy check just below uses:
if (2 == sscanf(cur, "stack depth %511s max %ld", ...
so the new checks alternate the comparison direction within about fifteen
lines.
> + s->stats[STACK] += sub_stack;
> + continue;
> + }
> if (2 == sscanf(cur, "stack depth %511s max %ld", stack, &s->stats[MAX_STACK]))
> continue;
> }
[ ... ]
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/31647029137
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.