Re: [PATCH 1/6] staging: rtl8188eu: use safe iterator in rtw_free_network_queue

Dan Carpenter
2021-05-18T08:29:38Z

On Mon, May 17, 2021 at 06:57:33PM +0300, Dan Carpenter wrote:
> Thanks for catching these... I've created a new Smatch static checker
> warning for this but it only works for list_for_each_entry().
> Eventually someone would have run the coccinelle script to convert these
> list_for_each loops into list_for_each_entry(). Otherwise you have to
> parse container_of() and I've been meaning to do that for a while but I
> haven't yet.
>
> Anyway, I'm going to test it out overnight and see what it finds. It's
> sort a new use for the modification_hook(), before I had only ever used
> it to silence warnings but this check uses it to trigger warnings. So
> perhaps it will generate a lot of false positives. We'll see.
>
> It sets the state of the iterator to &start at the start of the loop
> and if it's not &start state at the end then it prints a warning.
>
> regards,
> dan carpenter
>

That Smatch check didn't work at all. :P Back to the drawing board.

regards,
dan carpenter