Re: [PATCH v4a 00/38] timers: Use timer_shutdown*() before freeing timers

Julia Lawall
2022-11-06T03:16:16Z

On Sat, 5 Nov 2022, Steven Rostedt wrote:

> On Sun, 6 Nov 2022 11:05:14 +0800 (+08)
> Julia Lawall <julia.lawall@inria.fr> wrote:
>
> > > Thinking that's what you meant (examples would be easier to understand,
> > > than descriptions). And it didn't cover the return case. Does it only
> > > cover gotos?
> > >
> > > See drivers/net/wireless/intel/iwlwifi/mvm/sta.c for the false positive case:
> > >
> > > del_timer_sync(&baid_data->session_timer);
> > > [..]
> >
> > But there is a kfree_rcu(baid_data, rcu_head); right below. So it looks
> > fine?
>
> D'oh! I think you are correct. I didn't trust the script and it appears
> that it was correct all along. The free was hidden in between the code
> and I only noticed the kfree() in the error path. I thought that was a
> bug in the script. :-/
>
> I guess there were no false positives then. To be sure, I'll write a
> script to find all that have a return or goto in between and see what
> it comes up with.
>
> I guess my original patch doesn't need any changes from the script.
> I'll look more.

You could also consider expression ptr; rather than identifier ptr; if ptr
can be eg x->y. But if you have akready found all the calls with the
current script, then no need to be more general.

julia