Re: [PATCH v2 6/7] tracing: Handle synthetic event array field type checking correctly

From: Tom Zanussi
Date: Mon Oct 12 2020 - 18:24:58 EST


Hi Steve,

On Mon, 2020-10-12 at 18:14 -0400, Steven Rostedt wrote:
> On Mon, 12 Oct 2020 15:18:08 -0500
> Tom Zanussi <zanussi@xxxxxxxxxx> wrote:
>
> > @@ -630,8 +630,11 @@ static struct synth_field
> > *parse_synth_field(int argc, const char **argv,
> > if (field_type[0] == ';')
> > field_type++;
> > len = strlen(field_type) + 1;
> > - if (array)
> > + if (array) {
> > len += strlen(array);
> > + if (array[strlen(array) - 1] == ';')
> > + len--;
> > + }
>
> Why not:
>
> if (array) {
> int l = strlen(array);
>
> if (l && array[l - 1] == ';')
> l--;
> len += l;
> }
>

Yeah, I think that's better, will change it.

Thanks,

Tom

> -- Steve