Re: [PATCH v7 53/59] perf: Remove libperl support, legacy Perl scripts and tests

sashiko-bot
2026-04-25T23:16:31Z

Sashiko AI review found 1 potential issue(s):
- [Medium] The bounds check modification in `check_ev_match()` breaks event name parsing.
--

commit 50fd9d1826ce58398fcaac6c5b041e7dba41465e
Author: Ian Rogers <irogers@google.com>

perf: Remove libperl support, legacy Perl scripts and tests

Remove libperl support from perf, along with legacy Perl scripts
and their corresponding tests.

> diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
> --- a/tools/perf/ui/browsers/scripts.c
> +++ b/tools/perf/ui/browsers/scripts.c

[ ... ]

> @@ -126,8 +126,10 @@ static int check_ev_match(int dir_fd, const char *scriptname, struct perf_sessio
> len = strcspn(p, " \t");
> if (!len)
> break;
> + if ((size_t)len >= sizeof(evname))
> + len = sizeof(evname) - 1;
>
> - snprintf(evname, len + 1, "%s", p);
> + snprintf(evname, sizeof(evname), "%s", p);

Does this change break the event name extraction?

Previously, passing len + 1 as the size restricted snprintf to only copy
the characters up to the first whitespace. By changing the size limit to
sizeof(evname), it looks like snprintf will now copy the remainder of
the string, including any trailing spaces and subsequent script arguments.

If evname captures the rest of the line instead of just the isolated
event name, it appears the subsequent evsel__name_is(pos, evname) check
will always fail.

>
> match = 0;
> evlist__for_each_entry(session->evlist, pos) {

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260425224951.174663-1-irogers@google.com?part=53