Commit 9b97452b authored by Michal Wajdeczko's avatar Michal Wajdeczko Committed by Kees Cook

coccinelle: Add rules to find str_up_down() replacements

Add rules for finding places where str_up_down() can be used.
This currently finds over 20 locations.
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://lore.kernel.org/r/20240725101841.574-2-michal.wajdeczko@intel.comSigned-off-by: default avatarKees Cook <kees@kernel.org>
parent a98ae7f0
......@@ -39,3 +39,26 @@ e << str_plural_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e)
@str_up_down depends on patch@
expression E;
@@
(
- ((E) ? "up" : "down")
+ str_up_down(E)
)
@str_up_down_r depends on !patch exists@
expression E;
position P;
@@
(
* ((E@P) ? "up" : "down")
)
@script:python depends on report@
p << str_up_down_r.P;
e << str_up_down_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_up_down(%s)" % e)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment