[Cocci] Remove unnecessary null pointer checks?

SF Markus Elfring elfring at users.sourceforge.net
Sat Feb 22 09:09:27 CET 2014


> Not sure what you mean by extended.

I have tried the following search pattern.

@Show_functions_with_input_pointer_validation@
identifier fun, x;
type t;
@@
*fun(..., t* x, ...)
 {
  ...
  if (!x) return;
  ...
 }


Will your current tool version "1.0.0-rc20" find also the kfree() functions?
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/mm/slab.c#n3641

Should I add any variant of "unlikely(ZERO_OR_NULL_PTR(...))" to my filter
pattern eventually?


> If you want to propose Linux related fixes, you may want to look at the 
> kernel janitors mailing list.

Would it make sense to add the shown semantic patches to a specific script
directory?
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/scripts/coccinelle

Regards,
Markus


More information about the Cocci mailing list