summaryrefslogtreecommitdiffstats
path: root/tools/coccinelle
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-07-02 10:39:29 +0200
committerDonatas Abraitis <donatas.abraitis@gmail.com>2020-07-02 10:39:29 +0200
commitc54142bb84e86e563c228a0f82f1d5f6989dd952 (patch)
treea0faf1e8ee5a2ba0614764894cdf58b9f00dcec8 /tools/coccinelle
parentMerge pull request #6661 from donaldsharp/flag_is_singular (diff)
downloadfrr-c54142bb84e86e563c228a0f82f1d5f6989dd952.tar.xz
frr-c54142bb84e86e563c228a0f82f1d5f6989dd952.zip
tools: Catch argv_find() cases when testing only the index
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'tools/coccinelle')
-rw-r--r--tools/coccinelle/argv_find.cocci16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/coccinelle/argv_find.cocci b/tools/coccinelle/argv_find.cocci
new file mode 100644
index 000000000..f13b035d7
--- /dev/null
+++ b/tools/coccinelle/argv_find.cocci
@@ -0,0 +1,16 @@
+@@
+identifier idx;
+identifier argv;
+identifier argc;
+expression e1;
+expression e2;
+@@
+
+- argv_find(argv, argc, e1, &idx);
+ if (
+- idx
++ argv_find(argv, argc, e1, &idx)
+ )
+ {
+ e2;
+ }