All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
@ 2015-02-27 13:21 ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-02-27 13:21 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, Daniel Granat

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/device_id_tables.cocci | 95 ++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci

diff --git a/scripts/coccinelle/misc/device_id_tables.cocci b/scripts/coccinelle/misc/device_id_tables.cocci
new file mode 100644
index 0000000..5968984
--- /dev/null
+++ b/scripts/coccinelle/misc/device_id_tables.cocci
@@ -0,0 +1,95 @@
+/// Make sure '*_device_id$' tables are NULL terminated
+//
+// Keywords: device_id
+// Confidence: Medium
+// Options: --include-headers
+
+virtual org
+virtual report
+virtual patch
+
+@initialize:python@
+@@
+import re
+
+postfix = '_device_id$'
+prefix_list = ['platform', 'of', 'i2c']
+
+@r1 depends on patch || org || report@
+position p1;
+identifier var, arr;
+identifier struct_name;
+expression E;
+@@
+
+(
+struct struct_name arr[] = {
+	...,
+	{
+	.var = E,
+	}
+	@p1
+};
+|
+struct struct_name arr[] = {
+	...,
+	{ ..., var, ... },
+	@p1
+};
+)
+
+@script:python depends on report@
+struct_name << r1.struct_name;
+p1 << r1.p1;
+arr << r1.arr;
+pattern;
+@@
+
+for i in prefix_list:
+	pattern = str(i)+postfix
+        if re.match(pattern, struct_name) != None:
+		print "\nCOCCI: \"%s\" matchs required pattern \"%s\"" % (struct_name, pattern)
+		msg = "\"%s\" is not NULL terminated at line %s" % (arr, p1[0].line)
+        	coccilib.report.print_report(p1[0],msg)
+		break
+
+@script:python match depends on patch@
+struct_name << r1.struct_name;
+matched_name;
+pattern;
+@@
+
+coccinelle.matched_name = ''
+
+for i in prefix_list:
+	pattern = str(i)+postfix
+	if re.match(pattern, struct_name) != None:
+		coccinelle.matched_name = struct_name
+		break
+
+@r2 depends on patch@
+position r1.p1;
+identifier var, arr;
+identifier match.matched_name;
+expression E;
+@@
+
+(
+struct matched_name arr[] = { 
+        ...,
+        {
+        .var = E,
+-       }
+	@p1
++	},
++	{},
+};
+|
+struct matched_name arr[] = { 
+        ...,
+        { ..., var, ... },
+	@p1
++	{},
+};
+)
+
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
@ 2015-02-27 13:21 ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-02-27 13:21 UTC (permalink / raw)
  To: cocci

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/device_id_tables.cocci | 95 ++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci

diff --git a/scripts/coccinelle/misc/device_id_tables.cocci b/scripts/coccinelle/misc/device_id_tables.cocci
new file mode 100644
index 0000000..5968984
--- /dev/null
+++ b/scripts/coccinelle/misc/device_id_tables.cocci
@@ -0,0 +1,95 @@
+/// Make sure '*_device_id$' tables are NULL terminated
+//
+// Keywords: device_id
+// Confidence: Medium
+// Options: --include-headers
+
+virtual org
+virtual report
+virtual patch
+
+ at initialize:python@
+@@
+import re
+
+postfix = '_device_id$'
+prefix_list = ['platform', 'of', 'i2c']
+
+ at r1 depends on patch || org || report@
+position p1;
+identifier var, arr;
+identifier struct_name;
+expression E;
+@@
+
+(
+struct struct_name arr[] = {
+	...,
+	{
+	.var = E,
+	}
+	@p1
+};
+|
+struct struct_name arr[] = {
+	...,
+	{ ..., var, ... },
+	@p1
+};
+)
+
+ at script:python depends on report@
+struct_name << r1.struct_name;
+p1 << r1.p1;
+arr << r1.arr;
+pattern;
+@@
+
+for i in prefix_list:
+	pattern = str(i)+postfix
+        if re.match(pattern, struct_name) != None:
+		print "\nCOCCI: \"%s\" matchs required pattern \"%s\"" % (struct_name, pattern)
+		msg = "\"%s\" is not NULL terminated at line %s" % (arr, p1[0].line)
+        	coccilib.report.print_report(p1[0],msg)
+		break
+
+ at script:python match depends on patch@
+struct_name << r1.struct_name;
+matched_name;
+pattern;
+@@
+
+coccinelle.matched_name = ''
+
+for i in prefix_list:
+	pattern = str(i)+postfix
+	if re.match(pattern, struct_name) != None:
+		coccinelle.matched_name = struct_name
+		break
+
+ at r2 depends on patch@
+position r1.p1;
+identifier var, arr;
+identifier match.matched_name;
+expression E;
+@@
+
+(
+struct matched_name arr[] = { 
+        ...,
+        {
+        .var = E,
+-       }
+	@p1
++	},
++	{},
+};
+|
+struct matched_name arr[] = { 
+        ...,
+        { ..., var, ... },
+	@p1
++	{},
+};
+)
+
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
  2015-02-27 13:21 ` [Cocci] " Daniel Granat
@ 2015-03-27 10:32   ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-03-27 10:32 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, Karol Wrona

Hi,

Could you please review my patch I sent last month? It checks if tables 
in kernel are NULL terminated. Script matches only names specified in 
source code by postfix='*_device_id$' and by list of prefixes which is 
now prefix_list = ['platform', 'of', 'i2c']. I think it could by useful 
in kernel sources.

On 02/27/2015 02:21 PM, Daniel Granat wrote:
> <pre wrap>
 > Signed-off-by: Daniel Granat &lt;d.granat@samsung.com&gt;
 > ---
 > scripts/coccinelle/misc/device_id_tables.cocci | 95 
++++++++++++++++++++++++++
 > 1 file changed, 95 insertions(+)
 > create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci
 >
 > diff --git a/scripts/coccinelle/misc/device_id_tables.cocci 
b/scripts/coccinelle/misc/device_id_tables.cocci
 > new file mode 100644
 > index 0000000..5968984
 > --- /dev/null
 > +++ b/scripts/coccinelle/misc/device_id_tables.cocci
 > @@ -0,0 +1,95 @@
 > +/// Make sure '*_device_id$' tables are NULL terminated
 > +//
 > +// Keywords: device_id
 > +// Confidence: Medium
 > +// Options: --include-headers
 > +
 > +virtual org
 > +virtual report
 > +virtual patch
 > +
 > +@initialize:python@
 > +@@
 > +import re
 > +
 > +postfix = '_device_id$'
 > +prefix_list = ['platform', 'of', 'i2c']
 > +
 > +@r1 depends on patch || org || report@
 > +position p1;
 > +identifier var, arr;
 > +identifier struct_name;
 > +expression E;
 > +@@
 > +
 > +(
 > +struct struct_name arr[] = {
 > + ...,
 > + {
 > + .var = E,
 > + }
 > + @p1
 > +};
 > +|
 > +struct struct_name arr[] = {
 > + ...,
 > + { ..., var, ... },
 > + @p1
 > +};
 > +)
 > +
 > +@script:python depends on report@
 > +struct_name &lt;&lt; r1.struct_name;
 > +p1 &lt;&lt; r1.p1;
 > +arr &lt;&lt; r1.arr;
 > +pattern;
 > +@@
 > +
 > +for i in prefix_list:
 > + pattern = str(i)+postfix
 > + if re.match(pattern, struct_name) != None:
 > + print "\nCOCCI: \"%s\" matchs required pattern \"%s\"" % 
(struct_name, pattern)
 > + msg = "\"%s\" is not NULL terminated at line %s" % (arr, p1[0].line)
 > + coccilib.report.print_report(p1[0],msg)
 > + break
 > +
 > +@script:python match depends on patch@
 > +struct_name &lt;&lt; r1.struct_name;
 > +matched_name;
 > +pattern;
 > +@@
 > +
 > +coccinelle.matched_name = ''
 > +
 > +for i in prefix_list:
 > + pattern = str(i)+postfix
 > + if re.match(pattern, struct_name) != None:
 > + coccinelle.matched_name = struct_name
 > + break
 > +
 > +@r2 depends on patch@
 > +position r1.p1;
 > +identifier var, arr;
 > +identifier match.matched_name;
 > +expression E;
 > +@@
 > +
 > +(
 > +struct matched_name arr[] = {
 > + ...,
 > + {
 > + .var = E,
 > +- }
 > + @p1
 > ++ },
 > ++ {},
 > +};
 > +|
 > +struct matched_name arr[] = {
 > + ...,
 > + { ..., var, ... },
 > + @p1
 > ++ {},
 > +};
 > +)
 > +
 > </pre></body>
 > </html>
 > </html>



^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
@ 2015-03-27 10:32   ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-03-27 10:32 UTC (permalink / raw)
  To: cocci

Hi,

Could you please review my patch I sent last month? It checks if tables 
in kernel are NULL terminated. Script matches only names specified in 
source code by postfix='*_device_id$' and by list of prefixes which is 
now prefix_list = ['platform', 'of', 'i2c']. I think it could by useful 
in kernel sources.

On 02/27/2015 02:21 PM, Daniel Granat wrote:
> <pre wrap>
 > Signed-off-by: Daniel Granat &lt;d.granat at samsung.com&gt;
 > ---
 > scripts/coccinelle/misc/device_id_tables.cocci | 95 
++++++++++++++++++++++++++
 > 1 file changed, 95 insertions(+)
 > create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci
 >
 > diff --git a/scripts/coccinelle/misc/device_id_tables.cocci 
b/scripts/coccinelle/misc/device_id_tables.cocci
 > new file mode 100644
 > index 0000000..5968984
 > --- /dev/null
 > +++ b/scripts/coccinelle/misc/device_id_tables.cocci
 > @@ -0,0 +1,95 @@
 > +/// Make sure '*_device_id$' tables are NULL terminated
 > +//
 > +// Keywords: device_id
 > +// Confidence: Medium
 > +// Options: --include-headers
 > +
 > +virtual org
 > +virtual report
 > +virtual patch
 > +
 > + at initialize:python@
 > +@@
 > +import re
 > +
 > +postfix = '_device_id$'
 > +prefix_list = ['platform', 'of', 'i2c']
 > +
 > + at r1 depends on patch || org || report@
 > +position p1;
 > +identifier var, arr;
 > +identifier struct_name;
 > +expression E;
 > +@@
 > +
 > +(
 > +struct struct_name arr[] = {
 > + ...,
 > + {
 > + .var = E,
 > + }
 > + @p1
 > +};
 > +|
 > +struct struct_name arr[] = {
 > + ...,
 > + { ..., var, ... },
 > + @p1
 > +};
 > +)
 > +
 > + at script:python depends on report@
 > +struct_name &lt;&lt; r1.struct_name;
 > +p1 &lt;&lt; r1.p1;
 > +arr &lt;&lt; r1.arr;
 > +pattern;
 > +@@
 > +
 > +for i in prefix_list:
 > + pattern = str(i)+postfix
 > + if re.match(pattern, struct_name) != None:
 > + print "\nCOCCI: \"%s\" matchs required pattern \"%s\"" % 
(struct_name, pattern)
 > + msg = "\"%s\" is not NULL terminated at line %s" % (arr, p1[0].line)
 > + coccilib.report.print_report(p1[0],msg)
 > + break
 > +
 > + at script:python match depends on patch@
 > +struct_name &lt;&lt; r1.struct_name;
 > +matched_name;
 > +pattern;
 > +@@
 > +
 > +coccinelle.matched_name = ''
 > +
 > +for i in prefix_list:
 > + pattern = str(i)+postfix
 > + if re.match(pattern, struct_name) != None:
 > + coccinelle.matched_name = struct_name
 > + break
 > +
 > + at r2 depends on patch@
 > +position r1.p1;
 > +identifier var, arr;
 > +identifier match.matched_name;
 > +expression E;
 > +@@
 > +
 > +(
 > +struct matched_name arr[] = {
 > + ...,
 > + {
 > + .var = E,
 > +- }
 > + @p1
 > ++ },
 > ++ {},
 > +};
 > +|
 > +struct matched_name arr[] = {
 > + ...,
 > + { ..., var, ... },
 > + @p1
 > ++ {},
 > +};
 > +)
 > +
 > </pre></body>
 > </html>
 > </html>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
  2015-02-27 13:21 ` [Cocci] " Daniel Granat
@ 2015-04-22 11:08   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-22 11:08 UTC (permalink / raw)
  To: Daniel Granat, Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix

W dniu 27.02.2015 o 22:21, Daniel Granat pisze:
> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>   scripts/coccinelle/misc/device_id_tables.cocci | 95 ++++++++++++++++++++++++++
>   1 file changed, 95 insertions(+)
>   create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci

I like the idea and I think it is useful.
Tested-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>

However applying the patch gave some warnings:

Applying: Add coccinelle script that makes sure that tables are NULL terminated
/home/dev/linux/linux/.git/rebase-apply/patch:64: space before tab in indent.
        	coccilib.report.print_report(p1[0],msg)
/home/dev/linux/linux/.git/rebase-apply/patch:89: trailing whitespace.
struct matched_name arr[] = { 
/home/dev/linux/linux/.git/rebase-apply/patch:99: trailing whitespace.
struct matched_name arr[] = { 
/home/dev/linux/linux/.git/rebase-apply/patch:106: new blank line at EOF.
+
warning: 4 lines add whitespace errors.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
@ 2015-04-22 11:08   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-22 11:08 UTC (permalink / raw)
  To: cocci

W dniu 27.02.2015 o 22:21, Daniel Granat pisze:
> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>   scripts/coccinelle/misc/device_id_tables.cocci | 95 ++++++++++++++++++++++++++
>   1 file changed, 95 insertions(+)
>   create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci

I like the idea and I think it is useful.
Tested-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>

However applying the patch gave some warnings:

Applying: Add coccinelle script that makes sure that tables are NULL terminated
/home/dev/linux/linux/.git/rebase-apply/patch:64: space before tab in indent.
        	coccilib.report.print_report(p1[0],msg)
/home/dev/linux/linux/.git/rebase-apply/patch:89: trailing whitespace.
struct matched_name arr[] = { 
/home/dev/linux/linux/.git/rebase-apply/patch:99: trailing whitespace.
struct matched_name arr[] = { 
/home/dev/linux/linux/.git/rebase-apply/patch:106: new blank line at EOF.
+
warning: 4 lines add whitespace errors.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
  2015-04-22 11:08   ` [Cocci] " Krzysztof Kozlowski
@ 2015-04-22 11:16     ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-04-22 11:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix

Ok, but I'm going to improve the script. New coccinelle release give my 
opportunity to simplify this a lot, so I'll send next version of my 
patch soon.

Best regards,
--
Daniel Granat
Junior Software Engineer
Samsung R&D Institute Poland (SRPOL)
Al. Armii Ludowej 14, 00-638 Warszawa, Poland

On 04/22/2015 01:08 PM, Krzysztof Kozlowski wrote:
> W dniu 27.02.2015 o 22:21, Daniel Granat pisze:
>> Signed-off-by: Daniel Granat <d.granat@samsung.com>
>> ---
>>    scripts/coccinelle/misc/device_id_tables.cocci | 95 ++++++++++++++++++++++++++
>>    1 file changed, 95 insertions(+)
>>    create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci
>
> I like the idea and I think it is useful.
> Tested-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
>
> However applying the patch gave some warnings:
>
> Applying: Add coccinelle script that makes sure that tables are NULL terminated
> /home/dev/linux/linux/.git/rebase-apply/patch:64: space before tab in indent.
>          	coccilib.report.print_report(p1[0],msg)
> /home/dev/linux/linux/.git/rebase-apply/patch:89: trailing whitespace.
> struct matched_name arr[] = {
> /home/dev/linux/linux/.git/rebase-apply/patch:99: trailing whitespace.
> struct matched_name arr[] = {
> /home/dev/linux/linux/.git/rebase-apply/patch:106: new blank line at EOF.
> +
> warning: 4 lines add whitespace errors.
>
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH] Add coccinelle script that makes sure that tables are NULL terminated
@ 2015-04-22 11:16     ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-04-22 11:16 UTC (permalink / raw)
  To: cocci

Ok, but I'm going to improve the script. New coccinelle release give my 
opportunity to simplify this a lot, so I'll send next version of my 
patch soon.

Best regards,
--
Daniel Granat
Junior Software Engineer
Samsung R&D Institute Poland (SRPOL)
Al. Armii Ludowej 14, 00-638 Warszawa, Poland

On 04/22/2015 01:08 PM, Krzysztof Kozlowski wrote:
> W dniu 27.02.2015 o 22:21, Daniel Granat pisze:
>> Signed-off-by: Daniel Granat <d.granat@samsung.com>
>> ---
>>    scripts/coccinelle/misc/device_id_tables.cocci | 95 ++++++++++++++++++++++++++
>>    1 file changed, 95 insertions(+)
>>    create mode 100644 scripts/coccinelle/misc/device_id_tables.cocci
>
> I like the idea and I think it is useful.
> Tested-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
>
> However applying the patch gave some warnings:
>
> Applying: Add coccinelle script that makes sure that tables are NULL terminated
> /home/dev/linux/linux/.git/rebase-apply/patch:64: space before tab in indent.
>          	coccilib.report.print_report(p1[0],msg)
> /home/dev/linux/linux/.git/rebase-apply/patch:89: trailing whitespace.
> struct matched_name arr[] = {
> /home/dev/linux/linux/.git/rebase-apply/patch:99: trailing whitespace.
> struct matched_name arr[] = {
> /home/dev/linux/linux/.git/rebase-apply/patch:106: new blank line at EOF.
> +
> warning: 4 lines add whitespace errors.
>
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v2] Add coccinelle script that makes sure that tables are NULL terminated
  2015-02-27 13:21 ` [Cocci] " Daniel Granat
@ 2015-05-18 11:29   ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-05-18 11:29 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, Daniel Granat

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_platform.cocci | 65 +++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 scripts/coccinelle/misc/of_platform.cocci

diff --git a/scripts/coccinelle/misc/of_platform.cocci b/scripts/coccinelle/misc/of_platform.cocci
new file mode 100644
index 0000000..02c6195
--- /dev/null
+++ b/scripts/coccinelle/misc/of_platform.cocci
@@ -0,0 +1,65 @@
+/// Make sure that tables are NULL terminated
+//
+// Keywords: _device_id
+// Confidence: Medium
+// Options: --include-headers
+
+virtual report
+virtual patch
+
+@r depends on report@
+position p1;
+identifier var, arr;
+identifier name = {of_device_id, i2c_device_id, platform_device_id};
+expression E;
+@@
+
+(
+struct name arr[] = {
+	...,
+	{
+	.var = E,
+	}
+	@p1
+};
+|
+struct name arr[] = {
+	...,
+	{ ..., var, ... },
+	@p1
+};
+)
+
+@script:python depends on report@
+p1 << r.p1;
+arr << r.arr;
+@@
+
+msg = "%s is not NULL terminated at line %s" % (arr, p1[0].line)
+coccilib.report.print_report(p1[0],msg)
+
+@p depends on patch@
+position p1;
+identifier var, arr;
+identifier name = {of_device_id, i2c_device_id, platform_device_id};
+expression E;
+@@
+
+(
+struct name arr[] = {
+	...,
+	{
+	.var = E,
+-	}
+	@p1
++	},
++	{},
+};
+|
+struct name arr[] = {
+	...,
+	{ ..., var, ... },
+	@p1
++	{},
+};
+)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v2] Add coccinelle script that makes sure that tables are NULL terminated
@ 2015-05-18 11:29   ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-05-18 11:29 UTC (permalink / raw)
  To: cocci

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_platform.cocci | 65 +++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 scripts/coccinelle/misc/of_platform.cocci

diff --git a/scripts/coccinelle/misc/of_platform.cocci b/scripts/coccinelle/misc/of_platform.cocci
new file mode 100644
index 0000000..02c6195
--- /dev/null
+++ b/scripts/coccinelle/misc/of_platform.cocci
@@ -0,0 +1,65 @@
+/// Make sure that tables are NULL terminated
+//
+// Keywords: _device_id
+// Confidence: Medium
+// Options: --include-headers
+
+virtual report
+virtual patch
+
+ at r depends on report@
+position p1;
+identifier var, arr;
+identifier name = {of_device_id, i2c_device_id, platform_device_id};
+expression E;
+@@
+
+(
+struct name arr[] = {
+	...,
+	{
+	.var = E,
+	}
+	@p1
+};
+|
+struct name arr[] = {
+	...,
+	{ ..., var, ... },
+	@p1
+};
+)
+
+ at script:python depends on report@
+p1 << r.p1;
+arr << r.arr;
+@@
+
+msg = "%s is not NULL terminated at line %s" % (arr, p1[0].line)
+coccilib.report.print_report(p1[0],msg)
+
+@p depends on patch@
+position p1;
+identifier var, arr;
+identifier name = {of_device_id, i2c_device_id, platform_device_id};
+expression E;
+@@
+
+(
+struct name arr[] = {
+	...,
+	{
+	.var = E,
+-	}
+	@p1
++	},
++	{},
+};
+|
+struct name arr[] = {
+	...,
+	{ ..., var, ... },
+	@p1
++	{},
+};
+)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v2] Add coccinelle script that makes sure that tables are NULL terminated
  2015-05-18 11:29   ` [Cocci] " Daniel Granat
@ 2015-05-19  8:57     ` Julia Lawall
  -1 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-05-19  8:57 UTC (permalink / raw)
  To: Daniel Granat
  Cc: Julia.Lawall, cocci, linux-kernel, Gilles.Muller, nicolas.palix

There is already a rule misc/of_table.cocci for the of_device_id case.  I
think it would be better to extend that.

Also, rather than making an identifier name, it would be more efficient to
put struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] =
...  The Coccinelle will only work on files that contain those
identifiers.

julia

On Mon, 18 May 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_platform.cocci | 65 +++++++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
>  create mode 100644 scripts/coccinelle/misc/of_platform.cocci
>
> diff --git a/scripts/coccinelle/misc/of_platform.cocci b/scripts/coccinelle/misc/of_platform.cocci
> new file mode 100644
> index 0000000..02c6195
> --- /dev/null
> +++ b/scripts/coccinelle/misc/of_platform.cocci
> @@ -0,0 +1,65 @@
> +/// Make sure that tables are NULL terminated
> +//
> +// Keywords: _device_id
> +// Confidence: Medium
> +// Options: --include-headers
> +
> +virtual report
> +virtual patch
> +
> +@r depends on report@
> +position p1;
> +identifier var, arr;
> +identifier name = {of_device_id, i2c_device_id, platform_device_id};
> +expression E;
> +@@
> +
> +(
> +struct name arr[] = {
> +	...,
> +	{
> +	.var = E,
> +	}
> +	@p1
> +};
> +|
> +struct name arr[] = {
> +	...,
> +	{ ..., var, ... },
> +	@p1
> +};
> +)
> +
> +@script:python depends on report@
> +p1 << r.p1;
> +arr << r.arr;
> +@@
> +
> +msg = "%s is not NULL terminated at line %s" % (arr, p1[0].line)
> +coccilib.report.print_report(p1[0],msg)
> +
> +@p depends on patch@
> +position p1;
> +identifier var, arr;
> +identifier name = {of_device_id, i2c_device_id, platform_device_id};
> +expression E;
> +@@
> +
> +(
> +struct name arr[] = {
> +	...,
> +	{
> +	.var = E,
> +-	}
> +	@p1
> ++	},
> ++	{},
> +};
> +|
> +struct name arr[] = {
> +	...,
> +	{ ..., var, ... },
> +	@p1
> ++	{},
> +};
> +)
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v2] Add coccinelle script that makes sure that tables are NULL terminated
@ 2015-05-19  8:57     ` Julia Lawall
  0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-05-19  8:57 UTC (permalink / raw)
  To: cocci

There is already a rule misc/of_table.cocci for the of_device_id case.  I
think it would be better to extend that.

Also, rather than making an identifier name, it would be more efficient to
put struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] =
...  The Coccinelle will only work on files that contain those
identifiers.

julia

On Mon, 18 May 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_platform.cocci | 65 +++++++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
>  create mode 100644 scripts/coccinelle/misc/of_platform.cocci
>
> diff --git a/scripts/coccinelle/misc/of_platform.cocci b/scripts/coccinelle/misc/of_platform.cocci
> new file mode 100644
> index 0000000..02c6195
> --- /dev/null
> +++ b/scripts/coccinelle/misc/of_platform.cocci
> @@ -0,0 +1,65 @@
> +/// Make sure that tables are NULL terminated
> +//
> +// Keywords: _device_id
> +// Confidence: Medium
> +// Options: --include-headers
> +
> +virtual report
> +virtual patch
> +
> + at r depends on report@
> +position p1;
> +identifier var, arr;
> +identifier name = {of_device_id, i2c_device_id, platform_device_id};
> +expression E;
> +@@
> +
> +(
> +struct name arr[] = {
> +	...,
> +	{
> +	.var = E,
> +	}
> +	@p1
> +};
> +|
> +struct name arr[] = {
> +	...,
> +	{ ..., var, ... },
> +	@p1
> +};
> +)
> +
> + at script:python depends on report@
> +p1 << r.p1;
> +arr << r.arr;
> +@@
> +
> +msg = "%s is not NULL terminated at line %s" % (arr, p1[0].line)
> +coccilib.report.print_report(p1[0],msg)
> +
> + at p depends on patch@
> +position p1;
> +identifier var, arr;
> +identifier name = {of_device_id, i2c_device_id, platform_device_id};
> +expression E;
> +@@
> +
> +(
> +struct name arr[] = {
> +	...,
> +	{
> +	.var = E,
> +-	}
> +	@p1
> ++	},
> ++	{},
> +};
> +|
> +struct name arr[] = {
> +	...,
> +	{ ..., var, ... },
> +	@p1
> ++	{},
> +};
> +)
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v3] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
  2015-02-27 13:21 ` [Cocci] " Daniel Granat
@ 2015-05-19 11:58   ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-05-19 11:58 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, Daniel Granat

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..74f7dbb 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,7 +13,7 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -24,7 +24,8 @@ struct of_device_id arr[] = {
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +33,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v3] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
@ 2015-05-19 11:58   ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-05-19 11:58 UTC (permalink / raw)
  To: cocci

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..74f7dbb 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,7 +13,7 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -24,7 +24,8 @@ struct of_device_id arr[] = {
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +33,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v3] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
  2015-05-19 11:58   ` [Cocci] " Daniel Granat
@ 2015-05-25 20:19     ` Julia Lawall
  -1 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-05-25 20:19 UTC (permalink / raw)
  To: Daniel Granat
  Cc: Julia.Lawall, cocci, linux-kernel, Gilles.Muller, nicolas.palix



On Tue, 19 May 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_table.cocci | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..74f7dbb 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated
>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>  
> @@ -13,7 +13,7 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,

This case (the context case) needs a ..., E, ... case like the patch rule 
has.


> @@ -24,7 +24,8 @@ struct of_device_id arr[] = {
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +33,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>  
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> +	@p1

It is not a good idea to put the @p1 on the comma.  The comma might not be 
there, and if it is not there Coccinelle seems to crash.  A more graceful 
behavior would be for the rule simply not to match, since a comma that 
isn't there doesn't have a position.  In any case, if you put the @p1 on 
the }, things are better.

I made the following test case, if you want to make a quick check of the 
rule.  All four options should give four results.

 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, },
	{ "ab8540-rtc", (kernel_ulong_t)&ab8540_rtc_ops, },
 };
 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, },
        { "ab8540-rtc", (kernel_ulong_t)&ab8540_rtc_ops, }
 };
 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ .a = "ab8500-rtc", .b = (kernel_ulong_t)&ab8500_rtc_ops, },
	{ .a = "ab8540-rtc", .b = (kernel_ulong_t)&ab8540_rtc_ops, },
 };
 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ .a = "ab8500-rtc", .b = (kernel_ulong_t)&ab8500_rtc_ops, },
        { .a = "ab8540-rtc", .b = (kernel_ulong_t)&ab8540_rtc_ops, }
 };

julia

> +};
> +)
>  
>  @script:python depends on org@
>  p1 << r.p1;
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v3] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
@ 2015-05-25 20:19     ` Julia Lawall
  0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-05-25 20:19 UTC (permalink / raw)
  To: cocci



On Tue, 19 May 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_table.cocci | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..74f7dbb 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated
>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>  
> @@ -13,7 +13,7 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,

This case (the context case) needs a ..., E, ... case like the patch rule 
has.


> @@ -24,7 +24,8 @@ struct of_device_id arr[] = {
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +33,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>  
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> +	@p1

It is not a good idea to put the @p1 on the comma.  The comma might not be 
there, and if it is not there Coccinelle seems to crash.  A more graceful 
behavior would be for the rule simply not to match, since a comma that 
isn't there doesn't have a position.  In any case, if you put the @p1 on 
the }, things are better.

I made the following test case, if you want to make a quick check of the 
rule.  All four options should give four results.

 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, },
	{ "ab8540-rtc", (kernel_ulong_t)&ab8540_rtc_ops, },
 };
 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, },
        { "ab8540-rtc", (kernel_ulong_t)&ab8540_rtc_ops, }
 };
 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ .a = "ab8500-rtc", .b = (kernel_ulong_t)&ab8500_rtc_ops, },
	{ .a = "ab8540-rtc", .b = (kernel_ulong_t)&ab8540_rtc_ops, },
 };
 static const struct platform_device_id ab85xx_rtc_ids[] = {
	{ .a = "ab8500-rtc", .b = (kernel_ulong_t)&ab8500_rtc_ops, },
        { .a = "ab8540-rtc", .b = (kernel_ulong_t)&ab8540_rtc_ops, }
 };

julia

> +};
> +)
>  
>  @script:python depends on org@
>  p1 << r.p1;
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v4] Added tables i2c_device_id and platform_device_id for
  2015-05-19 11:58   ` [Cocci] " Daniel Granat
@ 2015-06-02 16:10     ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-02 16:10 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, k.wrona, k.kozlowski

Thank you for advices. I submit new patch with changes you suggested but I don't know why in "context" rule I get only two results instead of four.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v4] Added tables i2c_device_id and platform_device_id for
@ 2015-06-02 16:10     ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-02 16:10 UTC (permalink / raw)
  To: cocci

Thank you for advices. I submit new patch with changes you suggested but I don't know why in "context" rule I get only two results instead of four.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v4] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
  2015-06-02 16:10     ` [Cocci] " Daniel Granat
@ 2015-06-02 16:10       ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-02 16:10 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, k.wrona, k.kozlowski, Daniel Granat

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..bc3c944 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,27 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
+*	{ }, 
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +41,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v4] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
@ 2015-06-02 16:10       ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-02 16:10 UTC (permalink / raw)
  To: cocci

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..bc3c944 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,27 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
+*	{ }, 
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +41,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v4] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
  2015-06-02 16:10       ` [Cocci] " Daniel Granat
@ 2015-06-03  9:42         ` Julia Lawall
  -1 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-06-03  9:42 UTC (permalink / raw)
  To: Daniel Granat
  Cc: Julia.Lawall, cocci, linux-kernel, Gilles.Muller, nicolas.palix,
	k.wrona, k.kozlowski



On Tue, 2 Jun 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_table.cocci | 34 +++++++++++++++++++++++++++++-----
>  1 file changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..bc3c944 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated

It would be nice for the comment to be limited to 80 characters.

>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>
> @@ -13,18 +13,27 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  *	}
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> +*	{ },

This should be:

struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
        ...,
*       { ..., E, ... },
};

With that you get four results for the context case, like for the others.

The rest looks OK.

julia

> +};
> +)
>
>  @depends on patch@
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +41,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... }
> +	@p1
> +};
> +)
>
>  @script:python depends on org@
>  p1 << r.p1;
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v4] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
@ 2015-06-03  9:42         ` Julia Lawall
  0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-06-03  9:42 UTC (permalink / raw)
  To: cocci



On Tue, 2 Jun 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_table.cocci | 34 +++++++++++++++++++++++++++++-----
>  1 file changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..bc3c944 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of_device_id | i2c_device_id | platform_device_id) tables are NULL terminated

It would be nice for the comment to be limited to 80 characters.

>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>
> @@ -13,18 +13,27 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  *	}
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> +*	{ },

This should be:

struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
        ...,
*       { ..., E, ... },
};

With that you get four results for the context case, like for the others.

The rest looks OK.

julia

> +};
> +)
>
>  @depends on patch@
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +41,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... }
> +	@p1
> +};
> +)
>
>  @script:python depends on org@
>  p1 << r.p1;
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v5] Added tables (i2c/platform)_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
  2015-06-03  9:42         ` [Cocci] " Julia Lawall
@ 2015-06-23 11:02           ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-23 11:02 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, k.wrona, k.kozlowski, Daniel Granat

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..2294915 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,26 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+*	{ ..., E, ... },
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v5] Added tables (i2c/platform)_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
@ 2015-06-23 11:02           ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-23 11:02 UTC (permalink / raw)
  To: cocci

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..2294915 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,26 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+*	{ ..., E, ... },
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v5] Added tables (i2c/platform)_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
  2015-06-23 11:02           ` [Cocci] " Daniel Granat
@ 2015-06-23 11:50             ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2015-06-23 11:50 UTC (permalink / raw)
  To: Daniel Granat
  Cc: Julia.Lawall, cocci, linux-kernel, Gilles.Muller, nicolas.palix,
	k.wrona, Kozik

2015-06-23 20:02 GMT+09:00 Daniel Granat <d.granat@samsung.com>:
> Signed-off-by: Daniel Granat <d.granat@samsung.com>

Something went wrong. It looks like changelog was used as subject and
the body disappeared.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v5] Added tables (i2c/platform)_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
@ 2015-06-23 11:50             ` Krzysztof Kozlowski
  0 siblings, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2015-06-23 11:50 UTC (permalink / raw)
  To: cocci

2015-06-23 20:02 GMT+09:00 Daniel Granat <d.granat@samsung.com>:
> Signed-off-by: Daniel Granat <d.granat@samsung.com>

Something went wrong. It looks like changelog was used as subject and
the body disappeared.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v5] Added tables (i2c/platform)_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
  2015-06-23 11:02           ` [Cocci] " Daniel Granat
@ 2015-06-23 12:25             ` Julia Lawall
  -1 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-06-23 12:25 UTC (permalink / raw)
  To: Daniel Granat
  Cc: Julia.Lawall, cocci, linux-kernel, Gilles.Muller, nicolas.palix,
	k.wrona, k.kozlowski



On Tue, 23 Jun 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

> ---
>  scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
>  1 file changed, 28 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..2294915 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>
> @@ -13,18 +13,26 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  *	}
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +*	{ ..., E, ... },
> +};
> +)
>
>  @depends on patch@
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +40,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... }
> +	@p1
> +};
> +)
>
>  @script:python depends on org@
>  p1 << r.p1;
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v5] Added tables (i2c/platform)_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name.
@ 2015-06-23 12:25             ` Julia Lawall
  0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-06-23 12:25 UTC (permalink / raw)
  To: cocci



On Tue, 23 Jun 2015, Daniel Granat wrote:

> Signed-off-by: Daniel Granat <d.granat@samsung.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

> ---
>  scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
>  1 file changed, 28 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..2294915 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>
> @@ -13,18 +13,26 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  *	}
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +*	{ ..., E, ... },
> +};
> +)
>
>  @depends on patch@
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +40,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... }
> +	@p1
> +};
> +)
>
>  @script:python depends on org@
>  p1 << r.p1;
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v6] coccinelle: Improve checking for missing NULL terminators
  2015-06-23 12:25             ` [Cocci] " Julia Lawall
@ 2015-06-26 14:39               ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-26 14:39 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel
  Cc: Gilles.Muller, nicolas.palix, k.wrona, k.kozlowski, Daniel Granat

Extend checking on tables containing structures which are
initialized without specifying member name. Added new tables
for checking: i2c_device_id and platform_device_id.

Signed-off-by: Daniel Granat <d.granat@samsung.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
 scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..2294915 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,26 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+*	{ ..., E, ... },
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v6] coccinelle: Improve checking for missing NULL terminators
@ 2015-06-26 14:39               ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-06-26 14:39 UTC (permalink / raw)
  To: cocci

Extend checking on tables containing structures which are
initialized without specifying member name. Added new tables
for checking: i2c_device_id and platform_device_id.

Signed-off-by: Daniel Granat <d.granat@samsung.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
 scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..2294915 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,26 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+*	{ ..., E, ... },
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v6] coccinelle: Improve checking for missing NULL terminators
  2015-02-27 13:21 ` [Cocci] " Daniel Granat
@ 2015-10-23 15:31   ` Daniel Granat
  -1 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-10-23 15:31 UTC (permalink / raw)
  To: Julia.Lawall, cocci, linux-kernel, Gilles.Muller, nicolas.palix, mmarek
  Cc: sfr, d.granat

* Extend checking on tables containing structures which are
  initialized without specifying member name. Added new tables
  for checking: i2c_device_id and platform_device_id.

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..2294915 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,26 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+*	{ ..., E, ... },
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v6] coccinelle: Improve checking for missing NULL terminators
@ 2015-10-23 15:31   ` Daniel Granat
  0 siblings, 0 replies; 36+ messages in thread
From: Daniel Granat @ 2015-10-23 15:31 UTC (permalink / raw)
  To: cocci

* Extend checking on tables containing structures which are
  initialized without specifying member name. Added new tables
  for checking: i2c_device_id and platform_device_id.

Signed-off-by: Daniel Granat <d.granat@samsung.com>
---
 scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
index 3c93404..2294915 100644
--- a/scripts/coccinelle/misc/of_table.cocci
+++ b/scripts/coccinelle/misc/of_table.cocci
@@ -1,6 +1,6 @@
-/// Make sure of_device_id tables are NULL terminated
+/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
 //
-// Keywords: of_table
+// Keywords: of_table i2c_table platform_table
 // Confidence: Medium
 // Options: --include-headers
 
@@ -13,18 +13,26 @@ virtual report
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 *	}
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+*	{ ..., E, ... },
+};
+)
 
 @depends on patch@
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
@@ -32,19 +40,34 @@ struct of_device_id arr[] = {
 +	},
 +	{ }
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... },
++	{ },
+};
+)
 
 @r depends on org || report@
 position p1;
 identifier var, arr;
 expression E;
 @@
-struct of_device_id arr[] = {
+(
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
 	...,
 	{
 	.var = E,
 	}
 	@p1
 };
+|
+struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
+	...,
+	{ ..., E, ... }
+	@p1
+};
+)
 
 @script:python depends on org@
 p1 << r.p1;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v6] coccinelle: Improve checking for missing NULL terminators
  2015-10-23 15:31   ` [Cocci] " Daniel Granat
@ 2015-10-23 19:35     ` Julia Lawall
  -1 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-10-23 19:35 UTC (permalink / raw)
  To: Daniel Granat
  Cc: Julia.Lawall, cocci, linux-kernel, Gilles.Muller, nicolas.palix,
	mmarek, sfr

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

On Fri, 23 Oct 2015, Daniel Granat wrote:

> * Extend checking on tables containing structures which are
>   initialized without specifying member name. Added new tables
>   for checking: i2c_device_id and platform_device_id.
> 
> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
>  1 file changed, 28 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..2294915 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>  
> @@ -13,18 +13,26 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  *	}
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +*	{ ..., E, ... },
> +};
> +)
>  
>  @depends on patch@
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +40,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>  
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... }
> +	@p1
> +};
> +)
>  
>  @script:python depends on org@
>  p1 << r.p1;
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v6] coccinelle: Improve checking for missing NULL terminators
@ 2015-10-23 19:35     ` Julia Lawall
  0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-10-23 19:35 UTC (permalink / raw)
  To: cocci

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

On Fri, 23 Oct 2015, Daniel Granat wrote:

> * Extend checking on tables containing structures which are
>   initialized without specifying member name. Added new tables
>   for checking: i2c_device_id and platform_device_id.
> 
> Signed-off-by: Daniel Granat <d.granat@samsung.com>
> ---
>  scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++-----
>  1 file changed, 28 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 3c93404..2294915 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -1,6 +1,6 @@
> -/// Make sure of_device_id tables are NULL terminated
> +/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
>  //
> -// Keywords: of_table
> +// Keywords: of_table i2c_table platform_table
>  // Confidence: Medium
>  // Options: --include-headers
>  
> @@ -13,18 +13,26 @@ virtual report
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  *	}
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +*	{ ..., E, ... },
> +};
> +)
>  
>  @depends on patch@
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> @@ -32,19 +40,34 @@ struct of_device_id arr[] = {
>  +	},
>  +	{ }
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... },
> ++	{ },
> +};
> +)
>  
>  @r depends on org || report@
>  position p1;
>  identifier var, arr;
>  expression E;
>  @@
> -struct of_device_id arr[] = {
> +(
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
>  	}
>  	@p1
>  };
> +|
> +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
> +	...,
> +	{ ..., E, ... }
> +	@p1
> +};
> +)
>  
>  @script:python depends on org@
>  p1 << r.p1;
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v6] coccinelle: Improve checking for missing NULL terminators
  2015-10-23 19:35     ` [Cocci] " Julia Lawall
@ 2015-10-26 21:46       ` Michal Marek
  -1 siblings, 0 replies; 36+ messages in thread
From: Michal Marek @ 2015-10-26 21:46 UTC (permalink / raw)
  To: Julia Lawall, Daniel Granat
  Cc: cocci, linux-kernel, Gilles.Muller, nicolas.palix, sfr

Dne 23.10.2015 v 21:35 Julia Lawall napsal(a):
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> 
> On Fri, 23 Oct 2015, Daniel Granat wrote:
> 
>> * Extend checking on tables containing structures which are
>>   initialized without specifying member name. Added new tables
>>   for checking: i2c_device_id and platform_device_id.
>>
>> Signed-off-by: Daniel Granat <d.granat@samsung.com>

Applied to kbuild.git#misc.

Michal


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [Cocci] [PATCH v6] coccinelle: Improve checking for missing NULL terminators
@ 2015-10-26 21:46       ` Michal Marek
  0 siblings, 0 replies; 36+ messages in thread
From: Michal Marek @ 2015-10-26 21:46 UTC (permalink / raw)
  To: cocci

Dne 23.10.2015 v 21:35 Julia Lawall napsal(a):
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> 
> On Fri, 23 Oct 2015, Daniel Granat wrote:
> 
>> * Extend checking on tables containing structures which are
>>   initialized without specifying member name. Added new tables
>>   for checking: i2c_device_id and platform_device_id.
>>
>> Signed-off-by: Daniel Granat <d.granat@samsung.com>

Applied to kbuild.git#misc.

Michal

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2015-10-26 21:46 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 13:21 [PATCH] Add coccinelle script that makes sure that tables are NULL terminated Daniel Granat
2015-02-27 13:21 ` [Cocci] " Daniel Granat
2015-03-27 10:32 ` Daniel Granat
2015-03-27 10:32   ` [Cocci] " Daniel Granat
2015-04-22 11:08 ` Krzysztof Kozlowski
2015-04-22 11:08   ` [Cocci] " Krzysztof Kozlowski
2015-04-22 11:16   ` Daniel Granat
2015-04-22 11:16     ` [Cocci] " Daniel Granat
2015-05-18 11:29 ` [PATCH v2] " Daniel Granat
2015-05-18 11:29   ` [Cocci] " Daniel Granat
2015-05-19  8:57   ` Julia Lawall
2015-05-19  8:57     ` [Cocci] " Julia Lawall
2015-05-19 11:58 ` [PATCH v3] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name Daniel Granat
2015-05-19 11:58   ` [Cocci] " Daniel Granat
2015-05-25 20:19   ` Julia Lawall
2015-05-25 20:19     ` [Cocci] " Julia Lawall
2015-06-02 16:10   ` [PATCH v4] Added tables i2c_device_id and platform_device_id for Daniel Granat
2015-06-02 16:10     ` [Cocci] " Daniel Granat
2015-06-02 16:10     ` [PATCH v4] Added tables i2c_device_id and platform_device_id for checking. Extend checking on tables containing structures which are initialized without specifying member name Daniel Granat
2015-06-02 16:10       ` [Cocci] " Daniel Granat
2015-06-03  9:42       ` Julia Lawall
2015-06-03  9:42         ` [Cocci] " Julia Lawall
2015-06-23 11:02         ` [PATCH v5] Added tables (i2c/platform)_device_id " Daniel Granat
2015-06-23 11:02           ` [Cocci] " Daniel Granat
2015-06-23 11:50           ` Krzysztof Kozlowski
2015-06-23 11:50             ` [Cocci] " Krzysztof Kozlowski
2015-06-23 12:25           ` Julia Lawall
2015-06-23 12:25             ` [Cocci] " Julia Lawall
2015-06-26 14:39             ` [PATCH v6] coccinelle: Improve checking for missing NULL terminators Daniel Granat
2015-06-26 14:39               ` [Cocci] " Daniel Granat
2015-10-23 15:31 ` Daniel Granat
2015-10-23 15:31   ` [Cocci] " Daniel Granat
2015-10-23 19:35   ` Julia Lawall
2015-10-23 19:35     ` [Cocci] " Julia Lawall
2015-10-26 21:46     ` Michal Marek
2015-10-26 21:46       ` [Cocci] " Michal Marek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.