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/[email protected]/
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
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 7 lines · Markus Elfring
Hello,
I have noticed the patch “tty: serial:
fsl_lpuart: fix return value checking”.
https://lore.kernel.org/linux-serial/[email protected]/
https://lore.kernel.org/patchwork/patch/1215542/
https://lkml.org/lkml/2020/3/25/202
Quoted 5 lines
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
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 2 lines
Quoted 2 lines
I have noticed the patch “tty: serial:
fsl_lpuart: fix return value checking”.
https://lore.kernel.org/linux-serial/[email protected]/
…
Quoted 1 line
I'm not sure what there is to clarify.
Such an use case can point some software development challenges out.
Quoted 1 line
One can surely write rules that find this kind of problem,
I know this in principle.
Quoted 1 line
with a varying rate of false positives.
I am trying again to reduce this special case considerably.
Quoted 2 lines
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.
Quoted 1 line
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
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 2 lines
Quoted 2 lines
I have noticed the patch “tty: serial:
fsl_lpuart: fix return value checking”.
https://lore.kernel.org/linux-serial/[email protected]/
…
Quoted 2 lines
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.
Will further changes become more interesting also according to other development approaches you care for?
* Prequel
http://prequel-pql.gforge.inria.fr/
* Machine learning for software corrections
https://hal.inria.fr/hal-02373994
https://doi.org/10.1109/TSE.2019.2952614
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci