[Cocci] Remove unnecessary null pointer checks?

SF Markus Elfring elfring at users.sourceforge.net
Sun Feb 23 17:33:57 CET 2014


> Something goes wrong with the switch pattern. I would have to look into why.

Thanks for your quick feedback.


> But I think that a switch is highly improbable for making such a test,
> so you could just drop it.

I just try to make the discussed filter patterns as complete as possible.


> You may also want to specify that input has pointer type, since you are
> actually looking for NULL tests, not zero tests.

This is an important implementation detail which I would like to generalise so
that also functions like "btrfsic_process_written_block" will be safely found by
further source code searches.
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/fs/btrfs/check-integrity.c?id=878a876b2e10888afe53766dcca33f723ae20edc#n1835

This one was found by the previous simple pattern for example despite I expected
it to handle primarily pointer data types instead of an "unsigned int" in this case.

Regards,
Markus


More information about the Cocci mailing list