]> git.proxmox.com Git - mirror_frr.git/commitdiff
tools: Catch more argv_find() when not checked properly
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 12 May 2022 07:09:42 +0000 (10:09 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 12 May 2022 07:09:42 +0000 (10:09 +0300)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
tools/coccinelle/argv_find.cocci

index f13b035d7aa0f6b4b8bde7f0edc3968f1b0f6dc8..1ab19b749b4eb2ff04bc2969f2fc2347e4c4d1a5 100644 (file)
@@ -4,8 +4,10 @@ identifier argv;
 identifier argc;
 expression e1;
 expression e2;
+identifier I;
 @@
 
+(
 - argv_find(argv, argc, e1, &idx);
   if (
 -   idx
@@ -14,3 +16,8 @@ expression e2;
   {
     e2;
   }
+|
+- argv_find(argv, argc, e1, &idx);
+... when != I = idx;
+    when strict
+)