>> I have noticed the patch “tty: serial: fsl_lpuart: fix return value 
>> checking”.
>> https://lore.kernel.org/linux-serial/20200325090658.25967-2-mich...@walle.cc/
…
> I'm not sure what there is to clarify.

Such an use case can point some software development challenges out.


> One can surely write rules that find this kind of problem,

I know this in principle.


> with a varying rate of false positives.

I am trying again to reduce this special case considerably.


> A simple approach would be to check all occurrences of if (!ret) for an
> integer-typed variable, because typically that is the success case.

I would like to increase the probability for generation of corresponding fixes.

The success predicate can be also the opposite if you would like to take
a Linux macro like access_ok() or valid pointers (after memory allocations
for example) into account.


> But sometimes people do put the success case under an if.

I am curious how often such source code variations should be considered.

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to