On Wed, 25 Mar 2020, Markus Elfring wrote:
> I have noticed the patch “tty: serial: fsl_lpuart: fix return value checking”.
> I am curious if such a software transformation can be extended for similar
> source code searches also by the means of the semantic patch language.
> The proper knowledge of failure predicates for function calls is a key aspect
> for this use case.
> Would you like to clarify any corresponding development possibilities?
I'm not sure what there is to clarify. One can surely write rules that
find this kind of problem, with a varying rate of false positives.
A simple approach would be to check all occurrences of if (!ret) for an
integer-typed variable, because typically that is the success case. But
sometimes people do put the success case under an if.
Cocci mailing list