Re: kernel/trace/trace_events_hist.c:6174 event_hist_trigger_parse() error: we previously assumed 'glob' could be null (see line 6166)

From: Steven Rostedt
Date: Wed Jan 26 2022 - 10:27:09 EST


On Wed, 26 Jan 2022 17:50:20 +0300
Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> > I just reviewed the code, and it looks like the logic should keep glob from
> > ever being NULL.
>
> Smatch can also figure that out, and does not warn, if you have the
> cross function DB. Unfortunately, that's not feasible for the zero day
> bot because it takes too long to build the DB.
>
> I was puzzled why this warning showed up now when the code is from 2018.

Well it is called from trigger_process_regex() that gets buf passed in, and
that gets called by trace_boot_init_histograms(),
trace_boot_init_one_event() and event_trigger_regex_write(). All of which
pass in something for that glob parameter.

But I can see it being difficult to catch all that.

I have no problem adding the WARN_ON(), just to make it cleaner.

-- Steve