summaryrefslogtreecommitdiff
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorVaishali Thakkar <vaishali.thakkar@oracle.com>2016-05-24 09:49:17 +0530
committerMichal Marek <mmarek@suse.com>2016-06-20 17:20:13 +0200
commitbf56cc04ef97c8ec536e3fcd16fc57902cba339f (patch)
tree0e45c354d1a4b294f001ee876086196ca6b201da /scripts/coccinelle
parent1a695a905c18548062509178b98bc91e67510864 (diff)
Coccinelle: noderef: Add new rules and correct the old rule
Add new rules to detect the cases where sizeof is used in function calls as a argument. Also, for the patch mode third rule should behave same as second rule with arguments reversed. So, change that as well. Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts/coccinelle')
-rw-r--r--scripts/coccinelle/misc/noderef.cocci18
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci
index 80a831c91161..007f0de0c715 100644
--- a/scripts/coccinelle/misc/noderef.cocci
+++ b/scripts/coccinelle/misc/noderef.cocci
@@ -16,6 +16,7 @@ virtual patch
@depends on patch@
expression *x;
expression f;
+expression i;
type T;
@@
@@ -30,15 +31,26 @@ f(...,(T)(x),...,sizeof(
+ *x
),...)
|
-f(...,sizeof(x),...,(T)(
+f(...,sizeof(
+- x
++ *x
+ ),...,(T)(x),...)
+|
+f(...,(T)(x),...,i*sizeof(
- x
+ *x
),...)
+|
+f(...,i*sizeof(
+- x
++ *x
+ ),...,(T)(x),...)
)
@r depends on !patch@
expression *x;
expression f;
+expression i;
position p;
type T;
@@
@@ -49,6 +61,10 @@ type T;
*f(...,(T)(x),...,sizeof@p(x),...)
|
*f(...,sizeof@p(x),...,(T)(x),...)
+|
+*f(...,(T)(x),...,i*sizeof@p(x),...)
+|
+*f(...,i*sizeof@p(x),...,(T)(x),...)
)
@script:python depends on org@