Re: [RFC][PATCH 07/10] tracing: Have zero size length in filter logic be full string

From: Namhyung Kim
Date: Sun May 13 2018 - 22:23:05 EST


Hi,

On Sat, May 12, 2018 at 08:32:18PM +0200, Yann Ylavic wrote:
> On Fri, May 11, 2018 at 9:49 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> []
> >
> > static int regex_match_front(char *str, struct regex *r, int len)
> > {
> > - if (len < r->len)
> > + if (len && len < r->len)
> > return 0;
> >
> > - if (strncmp(str, r->pattern, r->len) == 0)
> > - return 1;
> > - return 0;
> > + return strncmp(str, r->pattern, len) == 0;
>
> strncmp(..., r->len) still?

Yep, I think so. Otherwise it'll always return true when len is 0.

Thanks,
Namhyung