On Wed, 28 Oct 2026 00:59:33 +0000, [email protected]
<[email protected]> wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s)
> to consider:
> - [Medium] tracing/filters: redundant check in regex_match_end() makes patch
> a no-op
> --
>
> commit 8e400c22f46c7fff9d91b8c8e837ab24dfa0f5cd
> Author: Masami Hiramatsu (Google) <[email protected]>
>
> tracing/filters: Fix regex_match_end() for zero-length strings
>
> This commit adds an early return in regex_match_end() when len <= r->len to
> avoid underflowing len - 1 and accessing the input string when len is 0 or
> smaller than the pattern.
>
> > diff --git a/kernel/trace/trace_events_filter.c
> > b/kernel/trace/trace_events_filter.c
> > index 5e74d2dae40a3..59a0d3ba72740 100644
> > --- a/kernel/trace/trace_events_filter.c
> > +++ b/kernel/trace/trace_events_filter.c
> > @@ -1075,8 +1075,12 @@ static int regex_match_middle(char *str, struct
> > regex *r, int len)
> >
> > static int regex_match_end(char *str, struct regex *r, int len)
> > {
> > - int strlen = len - 1;
> > + int strlen;
> >
> > + if (len <= r->len)
> > + return 0;
> > +
> > + strlen = len - 1;
> > if (strlen >= r->len &&
> > memcmp(str + strlen - r->len, r->pattern, r->len) == 0)
> > return 1;
>
> [Severity: Medium]
> Does this change have any functional effect in regex_match_end() in
> kernel/trace/trace_events_filter.c?
Oops, right. Please drop this patch. This is my fault (I suggested).
> > + if (len <= r->len)
and
> > if (strlen >= r->len &&
are the same...
Thanks!
--
Masami Hiramatsu (Google) <[email protected]>