Re: [Cocci] Determination of failure predicates for selected function calls with SmPL?
>> 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
Re: [Cocci] Determination of failure predicates for selected function calls with SmPL?
On Wed, 25 Mar 2020, Markus Elfring wrote: > Hello, > > 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/ > https://lore.kernel.org/patchwork/patch/1215542/ > https://lkml.org/lkml/2020/3/25/202 > > 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. julia___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
[Cocci] Determination of failure predicates for selected function calls with SmPL?
Hello, 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/ https://lore.kernel.org/patchwork/patch/1215542/ https://lkml.org/lkml/2020/3/25/202 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? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci