> I don't know what you are trying to do.

I have constructed another SmPL script variant.

@display@
expression x;
identifier action;
statement es;
@@
*if (!x)
    (<+...
(   sizeof(*x)
|
*   *x
|   action(...,
*          x
           , ...)
)
    ...+>);
 else
    es


This approach looks promising at the first glance.
Unfortunately, a corresponding test example shows that it is
still incomplete.

elfring@Sonne:~/Projekte/Linux/next-patched> spatch 
~/Projekte/Coccinelle/janitor/show_null_pointer_usage7.cocci init/main.c
…
@@ -815,9 +815,7 @@ static int __init initcall_blacklist(cha
…
                        entry = memblock_alloc(sizeof(*entry),
                                               SMP_CACHE_BYTES);
-                       if (!entry)
                                panic("%s: Failed to allocate %zu bytes\n",
-                                     __func__, sizeof(*entry));
…


Would you like to suggest any extensions for the exclusion
of such false positives?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to