All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
@ 2017-12-26 21:40 ` Himanshu Jha
  0 siblings, 0 replies; 79+ messages in thread
From: Himanshu Jha @ 2017-12-26 21:40 UTC (permalink / raw)
  To: yamada.masahiro
  Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, michal.lkml, cocci,
	linux-kernel, Himanshu Jha

There are many instances where memory is allocated using regular
allocator
functions immediately followed by setting the allocated memory
to 0 value using memset.

We already have zero memory allocator functions to set the memory to
0 value instead of manually setting it using memset.

Therefore, use zero memory allocating functions instead of regular
memory allocators followed by memset 0 to remove redundant memset and
make the code more cleaner and also reduce the code size.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---

v2:
   -fix typo in copyright.
   -move all the (T *) disjunction cases before (T) as (T) matches any cast
    at all including (T *) ones which is not desirable.

 scripts/coccinelle/api/alloc/kzalloc-simple.cocci | 373 +++++++++++++++++++++-
 1 file changed, 368 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
index 52c55e4..d08d526 100644
--- a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
@@ -1,5 +1,5 @@
 ///
-/// Use kzalloc rather than kmalloc followed by memset with 0
+/// Use zeroing allocator rather than allocator followed by memset with 0
 ///
 /// This considers some simple cases that are common and easy to validate
 /// Note in particular that there are no ...s in the rule, so all of the
@@ -8,6 +8,7 @@
 // Confidence: High
 // Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU.  GPLv2.
 // Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6.  GPLv2.
+// Copyright: (C) 2017 Himanshu Jha GPLv2.
 // URL: http://coccinelle.lip6.fr/rules/kzalloc.html
 // Options: --no-includes --include-headers
 //
@@ -28,11 +29,14 @@ virtual report
 @depends on context@
 type T, T2;
 expression x;
-expression E1,E2;
+expression E1;
 statement S;
 @@
 
-* x = (T)kmalloc(E1,E2);
+* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
+  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
+  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
+  kvmalloc_node(E1,...)\);
   if ((x==NULL) || ...) S
 * memset((T2)x,0,E1);
 
@@ -43,12 +47,101 @@ statement S;
 @depends on patch@
 type T, T2;
 expression x;
-expression E1,E2;
+expression E1,E2,E3,E4;
 statement S;
 @@
 
-- x = (T)kmalloc(E1,E2);
+(
+- x = kmalloc(E1,E2);
++ x = kzalloc(E1,E2);
+|
+- x = (T *)kmalloc(E1,E2);
 + x = kzalloc(E1,E2);
+|
+- x = (T)kmalloc(E1,E2);
++ x = (T)kzalloc(E1,E2);
+|
+- x = vmalloc(E1);
++ x = vzalloc(E1);
+|
+- x = (T *)vmalloc(E1);
++ x = vzalloc(E1);
+|
+- x = (T)vmalloc(E1);
++ x = (T)vzalloc(E1);
+|
+- x = dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_zalloc_coherent(E2,E1,E3,E4);
+|
+- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_zalloc_coherent(E2,E1,E3,E4);
+|
+- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
++ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
+|
+- x = kmalloc_node(E1,E2,E3);
++ x = kzalloc_node(E1,E2,E3);
+|
+- x = (T *)kmalloc_node(E1,E2,E3);
++ x = kzalloc_node(E1,E2,E3);
+|
+- x = (T)kmalloc_node(E1,E2,E3);
++ x = (T)kzalloc_node(E1,E2,E3);
+|
+- x = kmem_cache_alloc(E3,E4);
++ x = kmem_cache_zalloc(E3,E4);
+|
+- x = (T *)kmem_cache_alloc(E3,E4);
++ x = kmem_cache_zalloc(E3,E4);
+|
+- x = (T)kmem_cache_alloc(E3,E4);
++ x = (T)kmem_cache_zalloc(E3,E4);
+|
+- x = kmem_alloc(E1,E2);
++ x = kmem_zalloc(E1,E2);
+|
+- x = (T *)kmem_alloc(E1,E2);
++ x = kmem_zalloc(E1,E2);
+|
+- x = (T)kmem_alloc(E1,E2);
++ x = (T)kmem_zalloc(E1,E2);
+|
+- x = devm_kmalloc(E2,E1,E3);
++ x = devm_kzalloc(E2,E1,E3);
+|
+- x = (T *)devm_kmalloc(E2,E1,E3);
++ x = devm_kzalloc(E2,E1,E3);
+|
+- x = (T)devm_kmalloc(E2,E1,E3);
++ x = (T)devm_kzalloc(E2,E1,E3);
+|
+- x = kvmalloc(E1,E2);
++ x = kvzalloc(E1,E2);
+|
+- x = (T *)kvmalloc(E1,E2);
++ x = kvzalloc(E1,E2);
+|
+- x = (T)kvmalloc(E1,E2);
++ x = (T)kvzalloc(E1,E2);
+|
+- x = pci_alloc_consistent(E2,E1,E3);
++ x = pci_zalloc_consistent(E2,E1,E3);
+|
+- x = (T *)pci_alloc_consistent(E2,E1,E3);
++ x = pci_zalloc_consistent(E2,E1,E3);
+|
+- x = (T)pci_alloc_consistent(E2,E1,E3);
++ x = (T)pci_zalloc_consistent(E2,E1,E3);
+|
+- x = kvmalloc_node(E1,E2,E3);
++ x = kvzalloc_node(E1,E2,E3);
+|
+- x = (T *)kvmalloc_node(E1,E2,E3);
++ x = kvzalloc_node(E1,E2,E3);
+|
+- x = (T)kvmalloc_node(E1,E2,E3);
++ x = (T)kvzalloc_node(E1,E2,E3);
+)
   if ((x==NULL) || ...) S
 - memset((T2)x,0,E1);
 
@@ -84,3 +177,273 @@ x << r.x;
 
 msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x)
 coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r1 depends on org || report@
+type T, T2;
+expression x;
+expression E1;
+statement S;
+position p;
+@@
+
+ x = (T)vmalloc@p(E1);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r1.p;
+x << r1.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r1.p;
+x << r1.x;
+@@
+
+msg="WARNING: vzalloc should be used for %s, instead of vmalloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r2 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3,E4;
+statement S;
+position p;
+@@
+
+ x = (T)dma_alloc_coherent@p(E2,E1,E3,E4);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r2.p;
+x << r2.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r2.p;
+x << r2.x;
+@@
+
+msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r3 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)kmalloc_node@p(E1,E2,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r3.p;
+x << r3.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r3.p;
+x << r3.x;
+@@
+
+msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r4 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)kmem_cache_alloc@p(E2,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r4.p;
+x << r4.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r4.p;
+x << r4.x;
+@@
+
+msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r5 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2;
+statement S;
+position p;
+@@
+
+ x = (T)kmem_alloc@p(E1,E2);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r5.p;
+x << r5.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r5.p;
+x << r5.x;
+@@
+
+msg="WARNING: kmem_zalloc should be used for %s, instead of kmem_alloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r6 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)devm_kmalloc@p(E2,E1,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r6.p;
+x << r6.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r6.p;
+x << r6.x;
+@@
+
+msg="WARNING: devm_kzalloc should be used for %s, instead of devm_kmalloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r7 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2;
+statement S;
+position p;
+@@
+
+ x = (T)kvmalloc@p(E1,E2);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r7.p;
+x << r7.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r7.p;
+x << r7.x;
+@@
+
+msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+@r8 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)pci_alloc_consistent@p(E2,E1,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r8.p;
+x << r8.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r8.p;
+x << r8.x;
+@@
+
+msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+//-----------------------------------------------------------------
+@r9 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)kvmalloc_node@p(E1,E2,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r9.p;
+x << r9.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r9.p;
+x << r9.x;
+@@
+
+msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
-- 
2.7.4

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

* [Cocci] [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
@ 2017-12-26 21:40 ` Himanshu Jha
  0 siblings, 0 replies; 79+ messages in thread
From: Himanshu Jha @ 2017-12-26 21:40 UTC (permalink / raw)
  To: cocci

There are many instances where memory is allocated using regular
allocator
functions immediately followed by setting the allocated memory
to 0 value using memset.

We already have zero memory allocator functions to set the memory to
0 value instead of manually setting it using memset.

Therefore, use zero memory allocating functions instead of regular
memory allocators followed by memset 0 to remove redundant memset and
make the code more cleaner and also reduce the code size.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---

v2:
   -fix typo in copyright.
   -move all the (T *) disjunction cases before (T) as (T) matches any cast
    at all including (T *) ones which is not desirable.

 scripts/coccinelle/api/alloc/kzalloc-simple.cocci | 373 +++++++++++++++++++++-
 1 file changed, 368 insertions(+), 5 deletions(-)

diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
index 52c55e4..d08d526 100644
--- a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
@@ -1,5 +1,5 @@
 ///
-/// Use kzalloc rather than kmalloc followed by memset with 0
+/// Use zeroing allocator rather than allocator followed by memset with 0
 ///
 /// This considers some simple cases that are common and easy to validate
 /// Note in particular that there are no ...s in the rule, so all of the
@@ -8,6 +8,7 @@
 // Confidence: High
 // Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU.  GPLv2.
 // Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6.  GPLv2.
+// Copyright: (C) 2017 Himanshu Jha GPLv2.
 // URL: http://coccinelle.lip6.fr/rules/kzalloc.html
 // Options: --no-includes --include-headers
 //
@@ -28,11 +29,14 @@ virtual report
 @depends on context@
 type T, T2;
 expression x;
-expression E1,E2;
+expression E1;
 statement S;
 @@
 
-* x = (T)kmalloc(E1,E2);
+* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
+  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
+  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
+  kvmalloc_node(E1,...)\);
   if ((x==NULL) || ...) S
 * memset((T2)x,0,E1);
 
@@ -43,12 +47,101 @@ statement S;
 @depends on patch@
 type T, T2;
 expression x;
-expression E1,E2;
+expression E1,E2,E3,E4;
 statement S;
 @@
 
-- x = (T)kmalloc(E1,E2);
+(
+- x = kmalloc(E1,E2);
++ x = kzalloc(E1,E2);
+|
+- x = (T *)kmalloc(E1,E2);
 + x = kzalloc(E1,E2);
+|
+- x = (T)kmalloc(E1,E2);
++ x = (T)kzalloc(E1,E2);
+|
+- x = vmalloc(E1);
++ x = vzalloc(E1);
+|
+- x = (T *)vmalloc(E1);
++ x = vzalloc(E1);
+|
+- x = (T)vmalloc(E1);
++ x = (T)vzalloc(E1);
+|
+- x = dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_zalloc_coherent(E2,E1,E3,E4);
+|
+- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
++ x = dma_zalloc_coherent(E2,E1,E3,E4);
+|
+- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
++ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
+|
+- x = kmalloc_node(E1,E2,E3);
++ x = kzalloc_node(E1,E2,E3);
+|
+- x = (T *)kmalloc_node(E1,E2,E3);
++ x = kzalloc_node(E1,E2,E3);
+|
+- x = (T)kmalloc_node(E1,E2,E3);
++ x = (T)kzalloc_node(E1,E2,E3);
+|
+- x = kmem_cache_alloc(E3,E4);
++ x = kmem_cache_zalloc(E3,E4);
+|
+- x = (T *)kmem_cache_alloc(E3,E4);
++ x = kmem_cache_zalloc(E3,E4);
+|
+- x = (T)kmem_cache_alloc(E3,E4);
++ x = (T)kmem_cache_zalloc(E3,E4);
+|
+- x = kmem_alloc(E1,E2);
++ x = kmem_zalloc(E1,E2);
+|
+- x = (T *)kmem_alloc(E1,E2);
++ x = kmem_zalloc(E1,E2);
+|
+- x = (T)kmem_alloc(E1,E2);
++ x = (T)kmem_zalloc(E1,E2);
+|
+- x = devm_kmalloc(E2,E1,E3);
++ x = devm_kzalloc(E2,E1,E3);
+|
+- x = (T *)devm_kmalloc(E2,E1,E3);
++ x = devm_kzalloc(E2,E1,E3);
+|
+- x = (T)devm_kmalloc(E2,E1,E3);
++ x = (T)devm_kzalloc(E2,E1,E3);
+|
+- x = kvmalloc(E1,E2);
++ x = kvzalloc(E1,E2);
+|
+- x = (T *)kvmalloc(E1,E2);
++ x = kvzalloc(E1,E2);
+|
+- x = (T)kvmalloc(E1,E2);
++ x = (T)kvzalloc(E1,E2);
+|
+- x = pci_alloc_consistent(E2,E1,E3);
++ x = pci_zalloc_consistent(E2,E1,E3);
+|
+- x = (T *)pci_alloc_consistent(E2,E1,E3);
++ x = pci_zalloc_consistent(E2,E1,E3);
+|
+- x = (T)pci_alloc_consistent(E2,E1,E3);
++ x = (T)pci_zalloc_consistent(E2,E1,E3);
+|
+- x = kvmalloc_node(E1,E2,E3);
++ x = kvzalloc_node(E1,E2,E3);
+|
+- x = (T *)kvmalloc_node(E1,E2,E3);
++ x = kvzalloc_node(E1,E2,E3);
+|
+- x = (T)kvmalloc_node(E1,E2,E3);
++ x = (T)kvzalloc_node(E1,E2,E3);
+)
   if ((x==NULL) || ...) S
 - memset((T2)x,0,E1);
 
@@ -84,3 +177,273 @@ x << r.x;
 
 msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x)
 coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r1 depends on org || report@
+type T, T2;
+expression x;
+expression E1;
+statement S;
+position p;
+@@
+
+ x = (T)vmalloc at p(E1);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r1.p;
+x << r1.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r1.p;
+x << r1.x;
+@@
+
+msg="WARNING: vzalloc should be used for %s, instead of vmalloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r2 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3,E4;
+statement S;
+position p;
+@@
+
+ x = (T)dma_alloc_coherent at p(E2,E1,E3,E4);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r2.p;
+x << r2.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r2.p;
+x << r2.x;
+@@
+
+msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r3 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)kmalloc_node at p(E1,E2,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r3.p;
+x << r3.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r3.p;
+x << r3.x;
+@@
+
+msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r4 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)kmem_cache_alloc at p(E2,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r4.p;
+x << r4.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r4.p;
+x << r4.x;
+@@
+
+msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r5 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2;
+statement S;
+position p;
+@@
+
+ x = (T)kmem_alloc at p(E1,E2);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r5.p;
+x << r5.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r5.p;
+x << r5.x;
+@@
+
+msg="WARNING: kmem_zalloc should be used for %s, instead of kmem_alloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r6 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)devm_kmalloc at p(E2,E1,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r6.p;
+x << r6.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r6.p;
+x << r6.x;
+@@
+
+msg="WARNING: devm_kzalloc should be used for %s, instead of devm_kmalloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r7 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2;
+statement S;
+position p;
+@@
+
+ x = (T)kvmalloc at p(E1,E2);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r7.p;
+x << r7.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r7.p;
+x << r7.x;
+@@
+
+msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
+//-----------------------------------------------------------------
+ at r8 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)pci_alloc_consistent at p(E2,E1,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r8.p;
+x << r8.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+ at script:python depends on report@
+p << r8.p;
+x << r8.x;
+@@
+
+msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+//-----------------------------------------------------------------
+ at r9 depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2,E3;
+statement S;
+position p;
+@@
+
+ x = (T)kvmalloc_node at p(E1,E2,E3);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+ at script:python depends on org@
+p << r9.p;
+x << r9.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r9.p;
+x << r9.x;
+@@
+
+msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
+coccilib.report.print_report(p[0], msg)
+
-- 
2.7.4

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

* Re: [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
  2017-12-26 21:40 ` [Cocci] " Himanshu Jha
@ 2017-12-26 21:52   ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2017-12-26 21:52 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: yamada.masahiro, Julia Lawall, Gilles Muller, nicolas.palix,
	michal.lkml, cocci, linux-kernel



On Wed, 27 Dec 2017, Himanshu Jha wrote:

> There are many instances where memory is allocated using regular
> allocator
> functions immediately followed by setting the allocated memory
> to 0 value using memset.
>
> We already have zero memory allocator functions to set the memory to
> 0 value instead of manually setting it using memset.
>
> Therefore, use zero memory allocating functions instead of regular
> memory allocators followed by memset 0 to remove redundant memset and
> make the code more cleaner and also reduce the code size.
>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>

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

> ---
>
> v2:
>    -fix typo in copyright.
>    -move all the (T *) disjunction cases before (T) as (T) matches any cast
>     at all including (T *) ones which is not desirable.
>
>  scripts/coccinelle/api/alloc/kzalloc-simple.cocci | 373 +++++++++++++++++++++-
>  1 file changed, 368 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> index 52c55e4..d08d526 100644
> --- a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> @@ -1,5 +1,5 @@
>  ///
> -/// Use kzalloc rather than kmalloc followed by memset with 0
> +/// Use zeroing allocator rather than allocator followed by memset with 0
>  ///
>  /// This considers some simple cases that are common and easy to validate
>  /// Note in particular that there are no ...s in the rule, so all of the
> @@ -8,6 +8,7 @@
>  // Confidence: High
>  // Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU.  GPLv2.
>  // Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6.  GPLv2.
> +// Copyright: (C) 2017 Himanshu Jha GPLv2.
>  // URL: http://coccinelle.lip6.fr/rules/kzalloc.html
>  // Options: --no-includes --include-headers
>  //
> @@ -28,11 +29,14 @@ virtual report
>  @depends on context@
>  type T, T2;
>  expression x;
> -expression E1,E2;
> +expression E1;
>  statement S;
>  @@
>
> -* x = (T)kmalloc(E1,E2);
> +* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
> +  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
> +  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
> +  kvmalloc_node(E1,...)\);
>    if ((x==NULL) || ...) S
>  * memset((T2)x,0,E1);
>
> @@ -43,12 +47,101 @@ statement S;
>  @depends on patch@
>  type T, T2;
>  expression x;
> -expression E1,E2;
> +expression E1,E2,E3,E4;
>  statement S;
>  @@
>
> -- x = (T)kmalloc(E1,E2);
> +(
> +- x = kmalloc(E1,E2);
> ++ x = kzalloc(E1,E2);
> +|
> +- x = (T *)kmalloc(E1,E2);
>  + x = kzalloc(E1,E2);
> +|
> +- x = (T)kmalloc(E1,E2);
> ++ x = (T)kzalloc(E1,E2);
> +|
> +- x = vmalloc(E1);
> ++ x = vzalloc(E1);
> +|
> +- x = (T *)vmalloc(E1);
> ++ x = vzalloc(E1);
> +|
> +- x = (T)vmalloc(E1);
> ++ x = (T)vzalloc(E1);
> +|
> +- x = dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_zalloc_coherent(E2,E1,E3,E4);
> +|
> +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_zalloc_coherent(E2,E1,E3,E4);
> +|
> +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
> +|
> +- x = kmalloc_node(E1,E2,E3);
> ++ x = kzalloc_node(E1,E2,E3);
> +|
> +- x = (T *)kmalloc_node(E1,E2,E3);
> ++ x = kzalloc_node(E1,E2,E3);
> +|
> +- x = (T)kmalloc_node(E1,E2,E3);
> ++ x = (T)kzalloc_node(E1,E2,E3);
> +|
> +- x = kmem_cache_alloc(E3,E4);
> ++ x = kmem_cache_zalloc(E3,E4);
> +|
> +- x = (T *)kmem_cache_alloc(E3,E4);
> ++ x = kmem_cache_zalloc(E3,E4);
> +|
> +- x = (T)kmem_cache_alloc(E3,E4);
> ++ x = (T)kmem_cache_zalloc(E3,E4);
> +|
> +- x = kmem_alloc(E1,E2);
> ++ x = kmem_zalloc(E1,E2);
> +|
> +- x = (T *)kmem_alloc(E1,E2);
> ++ x = kmem_zalloc(E1,E2);
> +|
> +- x = (T)kmem_alloc(E1,E2);
> ++ x = (T)kmem_zalloc(E1,E2);
> +|
> +- x = devm_kmalloc(E2,E1,E3);
> ++ x = devm_kzalloc(E2,E1,E3);
> +|
> +- x = (T *)devm_kmalloc(E2,E1,E3);
> ++ x = devm_kzalloc(E2,E1,E3);
> +|
> +- x = (T)devm_kmalloc(E2,E1,E3);
> ++ x = (T)devm_kzalloc(E2,E1,E3);
> +|
> +- x = kvmalloc(E1,E2);
> ++ x = kvzalloc(E1,E2);
> +|
> +- x = (T *)kvmalloc(E1,E2);
> ++ x = kvzalloc(E1,E2);
> +|
> +- x = (T)kvmalloc(E1,E2);
> ++ x = (T)kvzalloc(E1,E2);
> +|
> +- x = pci_alloc_consistent(E2,E1,E3);
> ++ x = pci_zalloc_consistent(E2,E1,E3);
> +|
> +- x = (T *)pci_alloc_consistent(E2,E1,E3);
> ++ x = pci_zalloc_consistent(E2,E1,E3);
> +|
> +- x = (T)pci_alloc_consistent(E2,E1,E3);
> ++ x = (T)pci_zalloc_consistent(E2,E1,E3);
> +|
> +- x = kvmalloc_node(E1,E2,E3);
> ++ x = kvzalloc_node(E1,E2,E3);
> +|
> +- x = (T *)kvmalloc_node(E1,E2,E3);
> ++ x = kvzalloc_node(E1,E2,E3);
> +|
> +- x = (T)kvmalloc_node(E1,E2,E3);
> ++ x = (T)kvzalloc_node(E1,E2,E3);
> +)
>    if ((x==NULL) || ...) S
>  - memset((T2)x,0,E1);
>
> @@ -84,3 +177,273 @@ x << r.x;
>
>  msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x)
>  coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r1 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)vmalloc@p(E1);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r1.p;
> +x << r1.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r1.p;
> +x << r1.x;
> +@@
> +
> +msg="WARNING: vzalloc should be used for %s, instead of vmalloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r2 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3,E4;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)dma_alloc_coherent@p(E2,E1,E3,E4);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r2.p;
> +x << r2.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r2.p;
> +x << r2.x;
> +@@
> +
> +msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r3 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kmalloc_node@p(E1,E2,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r3.p;
> +x << r3.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r3.p;
> +x << r3.x;
> +@@
> +
> +msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r4 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kmem_cache_alloc@p(E2,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r4.p;
> +x << r4.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r4.p;
> +x << r4.x;
> +@@
> +
> +msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r5 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kmem_alloc@p(E1,E2);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r5.p;
> +x << r5.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r5.p;
> +x << r5.x;
> +@@
> +
> +msg="WARNING: kmem_zalloc should be used for %s, instead of kmem_alloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r6 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)devm_kmalloc@p(E2,E1,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r6.p;
> +x << r6.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r6.p;
> +x << r6.x;
> +@@
> +
> +msg="WARNING: devm_kzalloc should be used for %s, instead of devm_kmalloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r7 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kvmalloc@p(E1,E2);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r7.p;
> +x << r7.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r7.p;
> +x << r7.x;
> +@@
> +
> +msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> +@r8 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)pci_alloc_consistent@p(E2,E1,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r8.p;
> +x << r8.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r8.p;
> +x << r8.x;
> +@@
> +
> +msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +//-----------------------------------------------------------------
> +@r9 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kvmalloc_node@p(E1,E2,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> +@script:python depends on org@
> +p << r9.p;
> +x << r9.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> +@script:python depends on report@
> +p << r9.p;
> +x << r9.x;
> +@@
> +
> +msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> --
> 2.7.4
>
>

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

* [Cocci] [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
@ 2017-12-26 21:52   ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2017-12-26 21:52 UTC (permalink / raw)
  To: cocci



On Wed, 27 Dec 2017, Himanshu Jha wrote:

> There are many instances where memory is allocated using regular
> allocator
> functions immediately followed by setting the allocated memory
> to 0 value using memset.
>
> We already have zero memory allocator functions to set the memory to
> 0 value instead of manually setting it using memset.
>
> Therefore, use zero memory allocating functions instead of regular
> memory allocators followed by memset 0 to remove redundant memset and
> make the code more cleaner and also reduce the code size.
>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>

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

> ---
>
> v2:
>    -fix typo in copyright.
>    -move all the (T *) disjunction cases before (T) as (T) matches any cast
>     at all including (T *) ones which is not desirable.
>
>  scripts/coccinelle/api/alloc/kzalloc-simple.cocci | 373 +++++++++++++++++++++-
>  1 file changed, 368 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> index 52c55e4..d08d526 100644
> --- a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> @@ -1,5 +1,5 @@
>  ///
> -/// Use kzalloc rather than kmalloc followed by memset with 0
> +/// Use zeroing allocator rather than allocator followed by memset with 0
>  ///
>  /// This considers some simple cases that are common and easy to validate
>  /// Note in particular that there are no ...s in the rule, so all of the
> @@ -8,6 +8,7 @@
>  // Confidence: High
>  // Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU.  GPLv2.
>  // Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6.  GPLv2.
> +// Copyright: (C) 2017 Himanshu Jha GPLv2.
>  // URL: http://coccinelle.lip6.fr/rules/kzalloc.html
>  // Options: --no-includes --include-headers
>  //
> @@ -28,11 +29,14 @@ virtual report
>  @depends on context@
>  type T, T2;
>  expression x;
> -expression E1,E2;
> +expression E1;
>  statement S;
>  @@
>
> -* x = (T)kmalloc(E1,E2);
> +* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
> +  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
> +  devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
> +  kvmalloc_node(E1,...)\);
>    if ((x==NULL) || ...) S
>  * memset((T2)x,0,E1);
>
> @@ -43,12 +47,101 @@ statement S;
>  @depends on patch@
>  type T, T2;
>  expression x;
> -expression E1,E2;
> +expression E1,E2,E3,E4;
>  statement S;
>  @@
>
> -- x = (T)kmalloc(E1,E2);
> +(
> +- x = kmalloc(E1,E2);
> ++ x = kzalloc(E1,E2);
> +|
> +- x = (T *)kmalloc(E1,E2);
>  + x = kzalloc(E1,E2);
> +|
> +- x = (T)kmalloc(E1,E2);
> ++ x = (T)kzalloc(E1,E2);
> +|
> +- x = vmalloc(E1);
> ++ x = vzalloc(E1);
> +|
> +- x = (T *)vmalloc(E1);
> ++ x = vzalloc(E1);
> +|
> +- x = (T)vmalloc(E1);
> ++ x = (T)vzalloc(E1);
> +|
> +- x = dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_zalloc_coherent(E2,E1,E3,E4);
> +|
> +- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = dma_zalloc_coherent(E2,E1,E3,E4);
> +|
> +- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
> ++ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
> +|
> +- x = kmalloc_node(E1,E2,E3);
> ++ x = kzalloc_node(E1,E2,E3);
> +|
> +- x = (T *)kmalloc_node(E1,E2,E3);
> ++ x = kzalloc_node(E1,E2,E3);
> +|
> +- x = (T)kmalloc_node(E1,E2,E3);
> ++ x = (T)kzalloc_node(E1,E2,E3);
> +|
> +- x = kmem_cache_alloc(E3,E4);
> ++ x = kmem_cache_zalloc(E3,E4);
> +|
> +- x = (T *)kmem_cache_alloc(E3,E4);
> ++ x = kmem_cache_zalloc(E3,E4);
> +|
> +- x = (T)kmem_cache_alloc(E3,E4);
> ++ x = (T)kmem_cache_zalloc(E3,E4);
> +|
> +- x = kmem_alloc(E1,E2);
> ++ x = kmem_zalloc(E1,E2);
> +|
> +- x = (T *)kmem_alloc(E1,E2);
> ++ x = kmem_zalloc(E1,E2);
> +|
> +- x = (T)kmem_alloc(E1,E2);
> ++ x = (T)kmem_zalloc(E1,E2);
> +|
> +- x = devm_kmalloc(E2,E1,E3);
> ++ x = devm_kzalloc(E2,E1,E3);
> +|
> +- x = (T *)devm_kmalloc(E2,E1,E3);
> ++ x = devm_kzalloc(E2,E1,E3);
> +|
> +- x = (T)devm_kmalloc(E2,E1,E3);
> ++ x = (T)devm_kzalloc(E2,E1,E3);
> +|
> +- x = kvmalloc(E1,E2);
> ++ x = kvzalloc(E1,E2);
> +|
> +- x = (T *)kvmalloc(E1,E2);
> ++ x = kvzalloc(E1,E2);
> +|
> +- x = (T)kvmalloc(E1,E2);
> ++ x = (T)kvzalloc(E1,E2);
> +|
> +- x = pci_alloc_consistent(E2,E1,E3);
> ++ x = pci_zalloc_consistent(E2,E1,E3);
> +|
> +- x = (T *)pci_alloc_consistent(E2,E1,E3);
> ++ x = pci_zalloc_consistent(E2,E1,E3);
> +|
> +- x = (T)pci_alloc_consistent(E2,E1,E3);
> ++ x = (T)pci_zalloc_consistent(E2,E1,E3);
> +|
> +- x = kvmalloc_node(E1,E2,E3);
> ++ x = kvzalloc_node(E1,E2,E3);
> +|
> +- x = (T *)kvmalloc_node(E1,E2,E3);
> ++ x = kvzalloc_node(E1,E2,E3);
> +|
> +- x = (T)kvmalloc_node(E1,E2,E3);
> ++ x = (T)kvzalloc_node(E1,E2,E3);
> +)
>    if ((x==NULL) || ...) S
>  - memset((T2)x,0,E1);
>
> @@ -84,3 +177,273 @@ x << r.x;
>
>  msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x)
>  coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r1 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)vmalloc at p(E1);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r1.p;
> +x << r1.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r1.p;
> +x << r1.x;
> +@@
> +
> +msg="WARNING: vzalloc should be used for %s, instead of vmalloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r2 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3,E4;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)dma_alloc_coherent at p(E2,E1,E3,E4);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r2.p;
> +x << r2.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r2.p;
> +x << r2.x;
> +@@
> +
> +msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r3 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kmalloc_node at p(E1,E2,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r3.p;
> +x << r3.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r3.p;
> +x << r3.x;
> +@@
> +
> +msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r4 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kmem_cache_alloc at p(E2,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r4.p;
> +x << r4.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r4.p;
> +x << r4.x;
> +@@
> +
> +msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r5 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kmem_alloc at p(E1,E2);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r5.p;
> +x << r5.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r5.p;
> +x << r5.x;
> +@@
> +
> +msg="WARNING: kmem_zalloc should be used for %s, instead of kmem_alloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r6 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)devm_kmalloc at p(E2,E1,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r6.p;
> +x << r6.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r6.p;
> +x << r6.x;
> +@@
> +
> +msg="WARNING: devm_kzalloc should be used for %s, instead of devm_kmalloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r7 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kvmalloc at p(E1,E2);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r7.p;
> +x << r7.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r7.p;
> +x << r7.x;
> +@@
> +
> +msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> +//-----------------------------------------------------------------
> + at r8 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)pci_alloc_consistent at p(E2,E1,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r8.p;
> +x << r8.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r8.p;
> +x << r8.x;
> +@@
> +
> +msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +//-----------------------------------------------------------------
> + at r9 depends on org || report@
> +type T, T2;
> +expression x;
> +expression E1,E2,E3;
> +statement S;
> +position p;
> +@@
> +
> + x = (T)kvmalloc_node at p(E1,E2,E3);
> + if ((x==NULL) || ...) S
> + memset((T2)x,0,E1);
> +
> + at script:python depends on org@
> +p << r9.p;
> +x << r9.x;
> +@@
> +
> +msg="%s" % (x)
> +msg_safe=msg.replace("[","@(").replace("]",")")
> +coccilib.org.print_todo(p[0], msg_safe)
> +
> + at script:python depends on report@
> +p << r9.p;
> +x << r9.x;
> +@@
> +
> +msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +
> --
> 2.7.4
>
>

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

* Re: [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
  2017-12-26 21:40 ` [Cocci] " Himanshu Jha
@ 2017-12-29 17:22   ` Masahiro Yamada
  -1 siblings, 0 replies; 79+ messages in thread
From: Masahiro Yamada @ 2017-12-29 17:22 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	Linux Kernel Mailing List

2017-12-27 6:40 GMT+09:00 Himanshu Jha <himanshujha199640@gmail.com>:
> There are many instances where memory is allocated using regular
> allocator
> functions immediately followed by setting the allocated memory
> to 0 value using memset.
>
> We already have zero memory allocator functions to set the memory to
> 0 value instead of manually setting it using memset.
>
> Therefore, use zero memory allocating functions instead of regular
> memory allocators followed by memset 0 to remove redundant memset and
> make the code more cleaner and also reduce the code size.
>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
>
> v2:
>    -fix typo in copyright.
>    -move all the (T *) disjunction cases before (T) as (T) matches any cast
>     at all including (T *) ones which is not desirable.
>

...

> +@script:python depends on report@
> +p << r9.p;
> +x << r9.x;
> +@@
> +
> +msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +


I removed the blank line at EOF,
then applied to linux-kbuild/misc.  Thanks!




-- 
Best Regards
Masahiro Yamada

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

* [Cocci] [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
@ 2017-12-29 17:22   ` Masahiro Yamada
  0 siblings, 0 replies; 79+ messages in thread
From: Masahiro Yamada @ 2017-12-29 17:22 UTC (permalink / raw)
  To: cocci

2017-12-27 6:40 GMT+09:00 Himanshu Jha <himanshujha199640@gmail.com>:
> There are many instances where memory is allocated using regular
> allocator
> functions immediately followed by setting the allocated memory
> to 0 value using memset.
>
> We already have zero memory allocator functions to set the memory to
> 0 value instead of manually setting it using memset.
>
> Therefore, use zero memory allocating functions instead of regular
> memory allocators followed by memset 0 to remove redundant memset and
> make the code more cleaner and also reduce the code size.
>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
>
> v2:
>    -fix typo in copyright.
>    -move all the (T *) disjunction cases before (T) as (T) matches any cast
>     at all including (T *) ones which is not desirable.
>

...

> + at script:python depends on report@
> +p << r9.p;
> +x << r9.x;
> +@@
> +
> +msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
> +coccilib.report.print_report(p[0], msg)
> +


I removed the blank line at EOF,
then applied to linux-kbuild/misc.  Thanks!




-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
  2017-12-29 17:22   ` [Cocci] " Masahiro Yamada
@ 2017-12-29 17:49     ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2017-12-29 17:49 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Himanshu Jha, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	Linux Kernel Mailing List



On Sat, 30 Dec 2017, Masahiro Yamada wrote:

> 2017-12-27 6:40 GMT+09:00 Himanshu Jha <himanshujha199640@gmail.com>:
> > There are many instances where memory is allocated using regular
> > allocator
> > functions immediately followed by setting the allocated memory
> > to 0 value using memset.
> >
> > We already have zero memory allocator functions to set the memory to
> > 0 value instead of manually setting it using memset.
> >
> > Therefore, use zero memory allocating functions instead of regular
> > memory allocators followed by memset 0 to remove redundant memset and
> > make the code more cleaner and also reduce the code size.
> >
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> > ---
> >
> > v2:
> >    -fix typo in copyright.
> >    -move all the (T *) disjunction cases before (T) as (T) matches any cast
> >     at all including (T *) ones which is not desirable.
> >
>
> ...
>
> > +@script:python depends on report@
> > +p << r9.p;
> > +x << r9.x;
> > +@@
> > +
> > +msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
> > +coccilib.report.print_report(p[0], msg)
> > +
>
>
> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.  Thanks!

Thanks!

julia

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

* [Cocci] [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions
@ 2017-12-29 17:49     ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2017-12-29 17:49 UTC (permalink / raw)
  To: cocci



On Sat, 30 Dec 2017, Masahiro Yamada wrote:

> 2017-12-27 6:40 GMT+09:00 Himanshu Jha <himanshujha199640@gmail.com>:
> > There are many instances where memory is allocated using regular
> > allocator
> > functions immediately followed by setting the allocated memory
> > to 0 value using memset.
> >
> > We already have zero memory allocator functions to set the memory to
> > 0 value instead of manually setting it using memset.
> >
> > Therefore, use zero memory allocating functions instead of regular
> > memory allocators followed by memset 0 to remove redundant memset and
> > make the code more cleaner and also reduce the code size.
> >
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> > ---
> >
> > v2:
> >    -fix typo in copyright.
> >    -move all the (T *) disjunction cases before (T) as (T) matches any cast
> >     at all including (T *) ones which is not desirable.
> >
>
> ...
>
> > + at script:python depends on report@
> > +p << r9.p;
> > +x << r9.x;
> > +@@
> > +
> > +msg="WARNING: kvzalloc_node should be used for %s, instead of kvmalloc_node/memset" % (x)
> > +coccilib.report.print_report(p[0], msg)
> > +
>
>
> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.  Thanks!

Thanks!

julia

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
  2017-12-29 17:22   ` [Cocci] " Masahiro Yamada
@ 2018-01-02 14:25     ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-02 14:25 UTC (permalink / raw)
  To: cocci, Gilles Muller, Himanshu Jha, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: LKML, kernel-janitors

Hello,

A script for the semantic patch language was extended in significant ways.

[PATCH v2] Coccinelle: kzalloc-simple: Add “all” zero allocating functions
https://lkml.org/lkml/2017/12/26/182
https://patchwork.kernel.org/patch/10133277/
https://lkml.kernel.org/r/<1514324410-14561-1-git-send-email-himanshujha199640@gmail.com>
https://systeme.lip6.fr/pipermail/cocci/2017-December/004783.html

Now I find that it became more advanced than the previous version.
How do you think about to update also the corresponding file name
(instead of keeping the word “simple” there)?

Regards,
Markus

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-02 14:25     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-02 14:25 UTC (permalink / raw)
  To: cocci, Gilles Muller, Himanshu Jha, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: LKML, kernel-janitors

Hello,

A script for the semantic patch language was extended in significant ways.

[PATCH v2] Coccinelle: kzalloc-simple: Add “all” zero allocating functions
https://lkml.org/lkml/2017/12/26/182
https://patchwork.kernel.org/patch/10133277/
https://lkml.kernel.org/r/<1514324410-14561-1-git-send-email-himanshujha199640@gmail.com>
https://systeme.lip6.fr/pipermail/cocci/2017-December/004783.html

Now I find that it became more advanced than the previous version.
How do you think about to update also the corresponding file name
(instead of keeping the word “simple” there)?

Regards,
Markus

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
  2018-01-02 14:25     ` SF Markus Elfring
  (?)
@ 2018-01-02 14:28       ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-02 14:28 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]



On Tue, 2 Jan 2018, SF Markus Elfring wrote:

> Hello,
>
> A script for the semantic patch language was extended in significant ways.
>
> [PATCH v2] Coccinelle: kzalloc-simple: Add “all” zero allocating functions
> https://lkml.org/lkml/2017/12/26/182
> https://patchwork.kernel.org/patch/10133277/
> https://lkml.kernel.org/r/<1514324410-14561-1-git-send-email-himanshujha199640@gmail.com>
> https://systeme.lip6.fr/pipermail/cocci/2017-December/004783.html
>
> Now I find that it became more advanced than the previous version.
> How do you think about to update also the corresponding file name
> (instead of keeping the word “simple” there)?

Why not send a patch for it yourself?

julia

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-02 14:28       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-02 14:28 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]



On Tue, 2 Jan 2018, SF Markus Elfring wrote:

> Hello,
>
> A script for the semantic patch language was extended in significant ways.
>
> [PATCH v2] Coccinelle: kzalloc-simple: Add “all” zero allocating functions
> https://lkml.org/lkml/2017/12/26/182
> https://patchwork.kernel.org/patch/10133277/
> https://lkml.kernel.org/r/<1514324410-14561-1-git-send-email-himanshujha199640@gmail.com>
> https://systeme.lip6.fr/pipermail/cocci/2017-December/004783.html
>
> Now I find that it became more advanced than the previous version.
> How do you think about to update also the corresponding file name
> (instead of keeping the word “simple” there)?

Why not send a patch for it yourself?

julia

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

* [Cocci] Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-02 14:28       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-02 14:28 UTC (permalink / raw)
  To: cocci



On Tue, 2 Jan 2018, SF Markus Elfring wrote:

> Hello,
>
> A script for the semantic patch language was extended in significant ways.
>
> [PATCH v2] Coccinelle: kzalloc-simple: Add ?all? zero allocating functions
> https://lkml.org/lkml/2017/12/26/182
> https://patchwork.kernel.org/patch/10133277/
> https://lkml.kernel.org/r/<1514324410-14561-1-git-send-email-himanshujha199640@gmail.com>
> https://systeme.lip6.fr/pipermail/cocci/2017-December/004783.html
>
> Now I find that it became more advanced than the previous version.
> How do you think about to update also the corresponding file name
> (instead of keeping the word ?simple? there)?

Why not send a patch for it yourself?

julia

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
  2018-01-02 14:28       ` Julia Lawall
@ 2018-01-02 14:38         ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-02 14:38 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> Now I find that it became more advanced than the previous version.
>> How do you think about to update also the corresponding file name
>> (instead of keeping the word “simple” there)?
> 
> Why not send a patch for it yourself?

* I would like to check your views around renaming of such files.

* I am unsure which name will be better finally.
  Would we like to achieve another permalink here?

Regards,
Markus

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-02 14:38         ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-02 14:38 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> Now I find that it became more advanced than the previous version.
>> How do you think about to update also the corresponding file name
>> (instead of keeping the word “simple” there)?
> 
> Why not send a patch for it yourself?

* I would like to check your views around renaming of such files.

* I am unsure which name will be better finally.
  Would we like to achieve another permalink here?

Regards,
Markus

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
  2018-01-02 14:38         ` SF Markus Elfring
  (?)
@ 2018-01-02 14:43           ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-02 14:43 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]



On Tue, 2 Jan 2018, SF Markus Elfring wrote:

> >> Now I find that it became more advanced than the previous version.
> >> How do you think about to update also the corresponding file name
> >> (instead of keeping the word “simple” there)?
> >
> > Why not send a patch for it yourself?
>
> * I would like to check your views around renaming of such files.
>
> * I am unsure which name will be better finally.
>   Would we like to achieve another permalink here?

Actually, according to th original name choice it is stillsimple, becaue
it doesn't account for the possibility of many statement between the alloc
and the memset and it doesn't account for different ways of expressing the
size between the two calls.

If you want to be more general than kzalloc, then perhaps
zalloc-simple.cocci would be ok.

julia

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-02 14:43           ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-02 14:43 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]



On Tue, 2 Jan 2018, SF Markus Elfring wrote:

> >> Now I find that it became more advanced than the previous version.
> >> How do you think about to update also the corresponding file name
> >> (instead of keeping the word “simple” there)?
> >
> > Why not send a patch for it yourself?
>
> * I would like to check your views around renaming of such files.
>
> * I am unsure which name will be better finally.
>   Would we like to achieve another permalink here?

Actually, according to th original name choice it is stillsimple, becaue
it doesn't account for the possibility of many statement between the alloc
and the memset and it doesn't account for different ways of expressing the
size between the two calls.

If you want to be more general than kzalloc, then perhaps
zalloc-simple.cocci would be ok.

julia

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

* [Cocci] Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-02 14:43           ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-02 14:43 UTC (permalink / raw)
  To: cocci



On Tue, 2 Jan 2018, SF Markus Elfring wrote:

> >> Now I find that it became more advanced than the previous version.
> >> How do you think about to update also the corresponding file name
> >> (instead of keeping the word ?simple? there)?
> >
> > Why not send a patch for it yourself?
>
> * I would like to check your views around renaming of such files.
>
> * I am unsure which name will be better finally.
>   Would we like to achieve another permalink here?

Actually, according to th original name choice it is stillsimple, becaue
it doesn't account for the possibility of many statement between the alloc
and the memset and it doesn't account for different ways of expressing the
size between the two calls.

If you want to be more general than kzalloc, then perhaps
zalloc-simple.cocci would be ok.

julia

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
  2018-01-02 14:43           ` Julia Lawall
@ 2018-01-02 15:00             ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-02 15:00 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> * I am unsure which name will be better finally.
>>   Would we like to achieve another permalink here?
> 
> Actually, according to th original name choice it is stillsimple,

The involved contributors have got different views if the available script
remains “simple” enough at the moment.


> becaue it doesn't account for the possibility of many statement between
> the alloc and the memset

* How close should these function call be kept together?
* Which additional statements would you tolerate between them?


> and it doesn't account for different ways of expressing the size between
> the two calls.

Would you like to get any extensions there?


> If you want to be more general than kzalloc, then perhaps
> zalloc-simple.cocci would be ok.

Will other suffixes be safer for a permanent file name so that confusion
could be avoided around different expectations for “simplicity”?

Regards,
Markus

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-02 15:00             ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-02 15:00 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> * I am unsure which name will be better finally.
>>   Would we like to achieve another permalink here?
> 
> Actually, according to th original name choice it is stillsimple,

The involved contributors have got different views if the available script
remains “simple” enough at the moment.


> becaue it doesn't account for the possibility of many statement between
> the alloc and the memset

* How close should these function call be kept together?
* Which additional statements would you tolerate between them?


> and it doesn't account for different ways of expressing the size between
> the two calls.

Would you like to get any extensions there?


> If you want to be more general than kzalloc, then perhaps
> zalloc-simple.cocci would be ok.

Will other suffixes be safer for a permanent file name so that confusion
could be avoided around different expectations for “simplicity”?

Regards,
Markus

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

* [PATCH] Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-02 14:28       ` Julia Lawall
@ 2018-01-03 11:55         ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 11:55 UTC (permalink / raw)
  To: cocci, Gilles Muller, Himanshu Jha, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: LKML, kernel-janitors, Amitoj Kaur Chawla

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 Jan 2018 12:43:45 +0100

A script for the semantic patch language was extended
in a significant way.
An other file name is more appropriate then to indicate
the provided functionality. Thus rename this file.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 ...kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename scripts/coccinelle/api/alloc/{kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} (100%)

diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
similarity index 100%
rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
-- 
2.15.1

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

* [PATCH] Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 11:55         ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 11:55 UTC (permalink / raw)
  To: cocci, Gilles Muller, Himanshu Jha, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: LKML, kernel-janitors, Amitoj Kaur Chawla

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 Jan 2018 12:43:45 +0100

A script for the semantic patch language was extended
in a significant way.
An other file name is more appropriate then to indicate
the provided functionality. Thus rename this file.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 ...kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename scripts/coccinelle/api/alloc/{kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} (100%)

diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
similarity index 100%
rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
-- 
2.15.1



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

* Re: [PATCH] Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-03 11:55         ` SF Markus Elfring
  (?)
@ 2018-01-03 12:02           ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:02 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, LKML, kernel-janitors,
	Amitoj Kaur Chawla



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 3 Jan 2018 12:43:45 +0100
>
> A script for the semantic patch language was extended
> in a significant way.
> An other file name is more appropriate then to indicate
> the provided functionality. Thus rename this file.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  ...kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  rename scripts/coccinelle/api/alloc/{kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} (100%)
>
> diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> similarity index 100%
> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci

NACK. The name is too long and should not contain spaces.

julia

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

* Re: [PATCH] Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:02           ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:02 UTC (permalink / raw)
  To: cocci



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 3 Jan 2018 12:43:45 +0100
>
> A script for the semantic patch language was extended
> in a significant way.
> An other file name is more appropriate then to indicate
> the provided functionality. Thus rename this file.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  ...kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  rename scripts/coccinelle/api/alloc/{kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} (100%)
>
> diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> similarity index 100%
> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci

NACK. The name is too long and should not contain spaces.

julia

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

* [Cocci] [PATCH] Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:02           ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:02 UTC (permalink / raw)
  To: cocci



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 3 Jan 2018 12:43:45 +0100
>
> A script for the semantic patch language was extended
> in a significant way.
> An other file name is more appropriate then to indicate
> the provided functionality. Thus rename this file.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  ...kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  rename scripts/coccinelle/api/alloc/{kzalloc-simple.cocci => use zalloc functions with extra changes.cocci} (100%)
>
> diff --git a/scripts/coccinelle/api/alloc/kzalloc-simple.cocci b/scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> similarity index 100%
> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci

NACK. The name is too long and should not contain spaces.

julia

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-03 12:02           ` Julia Lawall
@ 2018-01-03 12:13             ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 12:13 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
>> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> 
> NACK.

It seems that we need a few more tries to achieve the desired consensus.


> The name is too long

How would you like to express the provided functionality in a “permanent” file name?


> and should not contain spaces.

May names contain space characters generally for Linux files?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:13             ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 12:13 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
>> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> 
> NACK.

It seems that we need a few more tries to achieve the desired consensus.


> The name is too long

How would you like to express the provided functionality in a “permanent” file name?


> and should not contain spaces.

May names contain space characters generally for Linux files?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-03 12:13             ` SF Markus Elfring
  (?)
@ 2018-01-03 12:17               ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:17 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, Amitoj Kaur Chawla, LKML,
	kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> >> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> >> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> >
> > NACK.
>
> It seems that we need a few more tries to achieve the desired consensus.
>
>
> > The name is too long
>
> How would you like to express the provided functionality in a
> “permanent” file name?

I have not idea what a permanent file name is.  The current name could be
better without the leading k, but otherwise I think it is fine.

>
>
> > and should not contain spaces.
>
> May names contain space characters generally for Linux files?

I have never seen a file name with spaces in the Linux kernel, but I don't
know an easy way to check for that.  But personally, I really dislike
them, and I will nack any patch that proposes to use one.

julia

>
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:17               ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:17 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> >> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> >> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> >
> > NACK.
>
> It seems that we need a few more tries to achieve the desired consensus.
>
>
> > The name is too long
>
> How would you like to express the provided functionality in a
> “permanent” file name?

I have not idea what a permanent file name is.  The current name could be
better without the leading k, but otherwise I think it is fine.

>
>
> > and should not contain spaces.
>
> May names contain space characters generally for Linux files?

I have never seen a file name with spaces in the Linux kernel, but I don't
know an easy way to check for that.  But personally, I really dislike
them, and I will nack any patch that proposes to use one.

julia

>
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* [Cocci] Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:17               ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:17 UTC (permalink / raw)
  To: cocci



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> >> rename from scripts/coccinelle/api/alloc/kzalloc-simple.cocci
> >> rename to scripts/coccinelle/api/alloc/use zalloc functions with extra changes.cocci
> >
> > NACK.
>
> It seems that we need a few more tries to achieve the desired consensus.
>
>
> > The name is too long
>
> How would you like to express the provided functionality in a
> ?permanent? file name?

I have not idea what a permanent file name is.  The current name could be
better without the leading k, but otherwise I think it is fine.

>
>
> > and should not contain spaces.
>
> May names contain space characters generally for Linux files?

I have never seen a file name with spaces in the Linux kernel, but I don't
know an easy way to check for that.  But personally, I really dislike
them, and I will nack any patch that proposes to use one.

julia

>
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-03 12:17               ` Julia Lawall
@ 2018-01-03 12:31                 ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 12:31 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> How would you like to express the provided functionality in a
>> “permanent” file name?
> 
> I have not idea what a permanent file name is.

Are you used to the selection of permalinks?


> The current name could be better without the leading k,
> but otherwise I think it is fine.

I suggest to express more details than to keep the word “simple” there.


>> May names contain space characters generally for Linux files?
> 
> I have never seen a file name with spaces in the Linux kernel,
> but I don't know an easy way to check for that.

Corresponding search tools can determine this if it would be desired.


> But personally, I really dislike them,

Interesting …


> and I will nack any patch that proposes to use one.

Would you insist to replace such “special characters” by dashes or underscores?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:31                 ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 12:31 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> How would you like to express the provided functionality in a
>> “permanent” file name?
> 
> I have not idea what a permanent file name is.

Are you used to the selection of permalinks?


> The current name could be better without the leading k,
> but otherwise I think it is fine.

I suggest to express more details than to keep the word “simple” there.


>> May names contain space characters generally for Linux files?
> 
> I have never seen a file name with spaces in the Linux kernel,
> but I don't know an easy way to check for that.

Corresponding search tools can determine this if it would be desired.


> But personally, I really dislike them,

Interesting …


> and I will nack any patch that proposes to use one.

Would you insist to replace such “special characters” by dashes or underscores?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-03 12:31                 ` SF Markus Elfring
  (?)
@ 2018-01-03 12:40                   ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:40 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, Amitoj Kaur Chawla, LKML,
	kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> >> How would you like to express the provided functionality in a
> >> “permanent” file name?
> >
> > I have not idea what a permanent file name is.
>
> Are you used to the selection of permalinks?
>
>
> > The current name could be better without the leading k,
> > but otherwise I think it is fine.
>
> I suggest to express more details than to keep the word “simple” there.
>
>
> >> May names contain space characters generally for Linux files?
> >
> > I have never seen a file name with spaces in the Linux kernel,
> > but I don't know an easy way to check for that.
>
> Corresponding search tools can determine this if it would be desired.
>
>
> > But personally, I really dislike them,
>
> Interesting …
>
>
> > and I will nack any patch that proposes to use one.
>
> Would you insist to replace such “special characters” by dashes or underscores?

Yes.  But I will also nack any very long name.

julia

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:40                   ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:40 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> >> How would you like to express the provided functionality in a
> >> “permanent” file name?
> >
> > I have not idea what a permanent file name is.
>
> Are you used to the selection of permalinks?
>
>
> > The current name could be better without the leading k,
> > but otherwise I think it is fine.
>
> I suggest to express more details than to keep the word “simple” there.
>
>
> >> May names contain space characters generally for Linux files?
> >
> > I have never seen a file name with spaces in the Linux kernel,
> > but I don't know an easy way to check for that.
>
> Corresponding search tools can determine this if it would be desired.
>
>
> > But personally, I really dislike them,
>
> Interesting …
>
>
> > and I will nack any patch that proposes to use one.
>
> Would you insist to replace such “special characters” by dashes or underscores?

Yes.  But I will also nack any very long name.

julia

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

* [Cocci] Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:40                   ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-03 12:40 UTC (permalink / raw)
  To: cocci



On Wed, 3 Jan 2018, SF Markus Elfring wrote:

> >> How would you like to express the provided functionality in a
> >> ?permanent? file name?
> >
> > I have not idea what a permanent file name is.
>
> Are you used to the selection of permalinks?
>
>
> > The current name could be better without the leading k,
> > but otherwise I think it is fine.
>
> I suggest to express more details than to keep the word ?simple? there.
>
>
> >> May names contain space characters generally for Linux files?
> >
> > I have never seen a file name with spaces in the Linux kernel,
> > but I don't know an easy way to check for that.
>
> Corresponding search tools can determine this if it would be desired.
>
>
> > But personally, I really dislike them,
>
> Interesting ?
>
>
> > and I will nack any patch that proposes to use one.
>
> Would you insist to replace such ?special characters? by dashes or underscores?

Yes.  But I will also nack any very long name.

julia

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-03 12:40                   ` Julia Lawall
@ 2018-01-03 12:45                     ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 12:45 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> Would you insist to replace such “special characters” by dashes or underscores?
> 
> Yes.  But I will also nack any very long name.

Will any other artificial identifier become appropriate if it would be too hard
to achieve consensus on a more meaningful description in the file name?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-03 12:45                     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-03 12:45 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> Would you insist to replace such “special characters” by dashes or underscores?
> 
> Yes.  But I will also nack any very long name.

Will any other artificial identifier become appropriate if it would be too hard
to achieve consensus on a more meaningful description in the file name?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-03 12:40                   ` Julia Lawall
@ 2018-01-04  8:36                     ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-04  8:36 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> Would you insist to replace such “special characters” by dashes or underscores?
> 
> Yes.  But I will also nack any very long name.

Would you find the the file name selection “zalloc-extra_changes1.cocci” acceptable?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-04  8:36                     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-04  8:36 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> Would you insist to replace such “special characters” by dashes or underscores?
> 
> Yes.  But I will also nack any very long name.

Would you find the the file name selection “zalloc-extra_changes1.cocci” acceptable?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-04  8:36                     ` SF Markus Elfring
  (?)
@ 2018-01-04  8:54                       ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-04  8:54 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, Amitoj Kaur Chawla, LKML,
	kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]



On Thu, 4 Jan 2018, SF Markus Elfring wrote:

> >> Would you insist to replace such “special characters” by dashes or underscores?
> >
> > Yes.  But I will also nack any very long name.
>
> Would you find the the file name selection “zalloc-extra_changes1.cocci” acceptable?

No.  I do't know what the extra changes are and I don't know what the
number 1 means.

julia

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-04  8:54                       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-04  8:54 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]



On Thu, 4 Jan 2018, SF Markus Elfring wrote:

> >> Would you insist to replace such “special characters” by dashes or underscores?
> >
> > Yes.  But I will also nack any very long name.
>
> Would you find the the file name selection “zalloc-extra_changes1.cocci” acceptable?

No.  I do't know what the extra changes are and I don't know what the
number 1 means.

julia

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

* [Cocci] Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-04  8:54                       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-04  8:54 UTC (permalink / raw)
  To: cocci



On Thu, 4 Jan 2018, SF Markus Elfring wrote:

> >> Would you insist to replace such ?special characters? by dashes or underscores?
> >
> > Yes.  But I will also nack any very long name.
>
> Would you find the the file name selection ?zalloc-extra_changes1.cocci? acceptable?

No.  I do't know what the extra changes are and I don't know what the
number 1 means.

julia

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
  2018-01-04  8:54                       ` Julia Lawall
@ 2018-01-04  9:43                         ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-04  9:43 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> Would you find the file name selection “zalloc-extra_changes1.cocci” acceptable?
> 
> No.

Next try then …


> I do't know what the extra changes are

This script for the semantic patch language was designed in the way
that more source code would be adjusted (or just reformatted)
than I see as an essential transformation for the replacement
of function calls in the shown case.

Example:
…
(
- x = kmalloc(E1,E2);
+ x = kzalloc(E1,E2);
|
…


We are discussing consequences from the specification of a different
change granularity for a while.
I hope that another SmPL script variant could be integrated
which will work with a higher precision then so that involved
software developers can choose the preferred transformation approach
also on their own.


> and I don't know what the number 1 means.

How do you think about to start with numbering for subsequent
SmPL scripts?

Regards,
Markus

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

* Re: Coccinelle: Rename the script for a transformation of memory allocations
@ 2018-01-04  9:43                         ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-04  9:43 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, Amitoj Kaur Chawla, LKML, kernel-janitors

>> Would you find the file name selection “zalloc-extra_changes1.cocci” acceptable?
> 
> No.

Next try then …


> I do't know what the extra changes are

This script for the semantic patch language was designed in the way
that more source code would be adjusted (or just reformatted)
than I see as an essential transformation for the replacement
of function calls in the shown case.

Example:
…
(
- x = kmalloc(E1,E2);
+ x = kzalloc(E1,E2);
|
…


We are discussing consequences from the specification of a different
change granularity for a while.
I hope that another SmPL script variant could be integrated
which will work with a higher precision then so that involved
software developers can choose the preferred transformation approach
also on their own.


> and I don't know what the number 1 means.

How do you think about to start with numbering for subsequent
SmPL scripts?

Regards,
Markus

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
  2018-01-02 14:43           ` Julia Lawall
@ 2018-01-08  9:55             ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-08  9:55 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

> If you want to be more general than kzalloc, then perhaps
> zalloc-simple.cocci would be ok.

Are you going to commit such a file name adjustment when it seems
that you would not like to accept any other suggestion there?

Regards,
Markus

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

* Re: Rename the SmPL script “kzalloc-….cocci”?
@ 2018-01-08  9:55             ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-08  9:55 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

> If you want to be more general than kzalloc, then perhaps
> zalloc-simple.cocci would be ok.

Are you going to commit such a file name adjustment when it seems
that you would not like to accept any other suggestion there?

Regards,
Markus

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

* Re: [v2] Coccinelle: zalloc-simple: Safer transformations with SmPL
  2017-12-29 17:22   ` [Cocci] " Masahiro Yamada
@ 2018-01-17 16:47     ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-17 16:47 UTC (permalink / raw)
  To: cocci, Masahiro Yamada, Himanshu Jha
  Cc: LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.

This script for the semantic patch language was extended. Now I find
that this development version contains some update candidates.
Implementation details can become safer in a few software design directions.

I suggest to start with another look at the distinction between pointer data types
and the other types. How much can corresponding source code review result in
further software improvements?

Regards,
Markus

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

* Re: [v2] Coccinelle: zalloc-simple: Safer transformations with SmPL
@ 2018-01-17 16:47     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-17 16:47 UTC (permalink / raw)
  To: cocci, Masahiro Yamada, Himanshu Jha
  Cc: LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.

This script for the semantic patch language was extended. Now I find
that this development version contains some update candidates.
Implementation details can become safer in a few software design directions.

I suggest to start with another look at the distinction between pointer data types
and the other types. How much can corresponding source code review result in
further software improvements?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
  2017-12-29 17:22   ` [Cocci] " Masahiro Yamada
@ 2018-01-19 16:14     ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-19 16:14 UTC (permalink / raw)
  To: cocci, Masahiro Yamada, Himanshu Jha
  Cc: LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.

This script for the semantic patch language is using the at sign within string
literals for Python code.

It is nice when this character seems to work also with the current software.
How does its usage fit to the following information in the SmPL manual?

https://github.com/coccinelle/coccinelle/blob/bf1c6a5869dd324f5faeeaa3a12d57270e478b21/docs/manual/cocci_syntax.tex#L50

“…
Furthermore, @ should not be used in this code.
Spatch scans the script code for the next @ and considers that to be the
beginning of the next rule, even if @ occurs within e.g., a comment.
…”


See also:
Configuration or escaping of @ characters for embedded programming language scripts
https://github.com/coccinelle/coccinelle/issues/36

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
@ 2018-01-19 16:14     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-19 16:14 UTC (permalink / raw)
  To: cocci, Masahiro Yamada, Himanshu Jha
  Cc: LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.

This script for the semantic patch language is using the at sign within string
literals for Python code.

It is nice when this character seems to work also with the current software.
How does its usage fit to the following information in the SmPL manual?

https://github.com/coccinelle/coccinelle/blob/bf1c6a5869dd324f5faeeaa3a12d57270e478b21/docs/manual/cocci_syntax.tex#L50

“…
Furthermore, @ should not be used in this code.
Spatch scans the script code for the next @ and considers that to be the
beginning of the next rule, even if @ occurs within e.g., a comment.
…”


See also:
Configuration or escaping of @ characters for embedded programming language scripts
https://github.com/coccinelle/coccinelle/issues/36

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
  2018-01-19 16:14     ` SF Markus Elfring
  (?)
@ 2018-01-19 16:18       ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-19 16:18 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Masahiro Yamada, Himanshu Jha, LKML, kernel-janitors,
	Gilles Muller, Luis R. Rodriguez, Michal Marek, Nicolas Palix

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]



On Fri, 19 Jan 2018, SF Markus Elfring wrote:

> > I removed the blank line at EOF,
> > then applied to linux-kbuild/misc.
>
> This script for the semantic patch language is using the at sign within string
> literals for Python code.
>
> It is nice when this character seems to work also with the current software.

So it works, but you are complaining anyway?

> How does its usage fit to the following information in the SmPL manual?
>
> https://github.com/coccinelle/coccinelle/blob/bf1c6a5869dd324f5faeeaa3a12d57270e478b21/docs/manual/cocci_syntax.tex#L50
>
> “…
> Furthermore, @ should not be used in this code.
> Spatch scans the script code for the next @ and considers that to be the
> beginning of the next rule, even if @ occurs within e.g., a comment.
> …”

I guess the conclusion is that it woks in strings (which are pretty
universal) and not in comments (which are language specific).

julia

>
> See also:
> Configuration or escaping of @ characters for embedded programming language scripts
> https://github.com/coccinelle/coccinelle/issues/36
>
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
@ 2018-01-19 16:18       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-19 16:18 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]



On Fri, 19 Jan 2018, SF Markus Elfring wrote:

> > I removed the blank line at EOF,
> > then applied to linux-kbuild/misc.
>
> This script for the semantic patch language is using the at sign within string
> literals for Python code.
>
> It is nice when this character seems to work also with the current software.

So it works, but you are complaining anyway?

> How does its usage fit to the following information in the SmPL manual?
>
> https://github.com/coccinelle/coccinelle/blob/bf1c6a5869dd324f5faeeaa3a12d57270e478b21/docs/manual/cocci_syntax.tex#L50
>
> “…
> Furthermore, @ should not be used in this code.
> Spatch scans the script code for the next @ and considers that to be the
> beginning of the next rule, even if @ occurs within e.g., a comment.
> …”

I guess the conclusion is that it woks in strings (which are pretty
universal) and not in comments (which are language specific).

julia

>
> See also:
> Configuration or escaping of @ characters for embedded programming language scripts
> https://github.com/coccinelle/coccinelle/issues/36
>
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* [Cocci] Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
@ 2018-01-19 16:18       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-19 16:18 UTC (permalink / raw)
  To: cocci



On Fri, 19 Jan 2018, SF Markus Elfring wrote:

> > I removed the blank line at EOF,
> > then applied to linux-kbuild/misc.
>
> This script for the semantic patch language is using the at sign within string
> literals for Python code.
>
> It is nice when this character seems to work also with the current software.

So it works, but you are complaining anyway?

> How does its usage fit to the following information in the SmPL manual?
>
> https://github.com/coccinelle/coccinelle/blob/bf1c6a5869dd324f5faeeaa3a12d57270e478b21/docs/manual/cocci_syntax.tex#L50
>
> ??
> Furthermore, @ should not be used in this code.
> Spatch scans the script code for the next @ and considers that to be the
> beginning of the next rule, even if @ occurs within e.g., a comment.
> ??

I guess the conclusion is that it woks in strings (which are pretty
universal) and not in comments (which are language specific).

julia

>
> See also:
> Configuration or escaping of @ characters for embedded programming language scripts
> https://github.com/coccinelle/coccinelle/issues/36
>
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
  2018-01-19 16:18       ` Julia Lawall
@ 2018-01-19 16:43         ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-19 16:43 UTC (permalink / raw)
  To: Julia Lawall, Masahiro Yamada, Himanshu Jha
  Cc: cocci, LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> So it works, but you are complaining anyway?

I dare to point a contradiction out between two information sources
once more.

Is this SmPL script really working in intended way already?


> I guess the conclusion is that it woks in strings (which are pretty
> universal) and not in comments (which are language specific).

Does the documentation need another update for the Coccinelle software
to achieve the desired correctness?


Which software design direction will get priority in such an use case?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
@ 2018-01-19 16:43         ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-19 16:43 UTC (permalink / raw)
  To: Julia Lawall, Masahiro Yamada, Himanshu Jha
  Cc: cocci, LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> So it works, but you are complaining anyway?

I dare to point a contradiction out between two information sources
once more.

Is this SmPL script really working in intended way already?


> I guess the conclusion is that it woks in strings (which are pretty
> universal) and not in comments (which are language specific).

Does the documentation need another update for the Coccinelle software
to achieve the desired correctness?


Which software design direction will get priority in such an use case?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
  2018-01-19 16:18       ` Julia Lawall
@ 2018-01-24  8:41         ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-24  8:41 UTC (permalink / raw)
  To: Julia Lawall, Masahiro Yamada, Himanshu Jha
  Cc: cocci, LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> So it works, but you are complaining anyway?

How serious do you interpret such information in the SmPL manual?


>> https://github.com/coccinelle/coccinelle/blob/bf1c6a5869dd324f5faeeaa3a12d57270e478b21/docs/manual/cocci_syntax.tex#L50
>>
>> “…
>> Furthermore, @ should not be used in this code.
>> …”
> 
> I guess the conclusion is that it woks in strings (which are pretty
> universal) and not in comments (which are language specific).

Would you like to achieve any safer data processing for potentially “reserved” characters?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings
@ 2018-01-24  8:41         ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-24  8:41 UTC (permalink / raw)
  To: Julia Lawall, Masahiro Yamada, Himanshu Jha
  Cc: cocci, LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> So it works, but you are complaining anyway?

How serious do you interpret such information in the SmPL manual?


>> https://github.com/coccinelle/coccinelle/blob/bf1c6a5869dd324f5faeeaa3a12d57270e478b21/docs/manual/cocci_syntax.tex#L50
>>
>> “…
>> Furthermore, @ should not be used in this code.
>> …”
> 
> I guess the conclusion is that it woks in strings (which are pretty
> universal) and not in comments (which are language specific).

Would you like to achieve any safer data processing for potentially “reserved” characters?

Regards,
Markus

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

* Re: [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules
  2017-12-29 17:22   ` [Cocci] " Masahiro Yamada
  (?)
@ 2018-01-31 17:28     ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-31 17:28 UTC (permalink / raw)
  To: cocci, Masahiro Yamada, Himanshu Jha
  Cc: LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.

I have taken another look at this script for the semantic patch language.
I imagined that I could refactor the shown SmPL disjunctions a bit.
But I noticed then that these SmPL rules contain a development mistake.

The deletion for a call of the function “memset” depends on the specification
that a size determination is passed by the expression “E1”.
The function “kmem_cache_alloc” was specified despite of the technical detail
that this function does not get a parameter passed which would correspond
to such a size information.
https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=537659c08a7da298aa748854f65f2aa1f31b1378#n14

Thus I suggest to remove it from the first two SmPL rules and omit the rule “r4”.
Will the rule set be more consistent then?

Regards,
Markus

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

* Re: [v2] Coccinelle: zalloc-simple: Delete function  =?UTF-8?B?4oCca21lbV9jYWNoZV9hbGxvY
@ 2018-01-31 17:28     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-31 17:28 UTC (permalink / raw)
  To: cocci

> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.

I have taken another look at this script for the semantic patch language.
I imagined that I could refactor the shown SmPL disjunctions a bit.
But I noticed then that these SmPL rules contain a development mistake.

The deletion for a call of the function “memset” depends on the specification
that a size determination is passed by the expression “E1”.
The function “kmem_cache_alloc” was specified despite of the technical detail
that this function does not get a parameter passed which would correspond
to such a size information.
https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?idS7659c08a7da298aa748854f65f2aa1f31b1378#n14

Thus I suggest to remove it from the first two SmPL rules and omit the rule “r4”.
Will the rule set be more consistent then?

Regards,
Markus

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

* [Cocci] [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules
@ 2018-01-31 17:28     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-31 17:28 UTC (permalink / raw)
  To: cocci

> I removed the blank line at EOF,
> then applied to linux-kbuild/misc.

I have taken another look at this script for the semantic patch language.
I imagined that I could refactor the shown SmPL disjunctions a bit.
But I noticed then that these SmPL rules contain a development mistake.

The deletion for a call of the function ?memset? depends on the specification
that a size determination is passed by the expression ?E1?.
The function ?kmem_cache_alloc? was specified despite of the technical detail
that this function does not get a parameter passed which would correspond
to such a size information.
https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=537659c08a7da298aa748854f65f2aa1f31b1378#n14

Thus I suggest to remove it from the first two SmPL rules and omit the rule ?r4?.
Will the rule set be more consistent then?

Regards,
Markus

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

* Re: [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules
  2018-01-31 17:28     ` [v2] Coccinelle: zalloc-simple: Delete function =?UTF-8?B?4oCca21lbV9jYWNoZV9hbGxvY SF Markus Elfring
  (?)
@ 2018-01-31 17:38       ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-31 17:38 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Masahiro Yamada, Himanshu Jha, LKML, kernel-janitors,
	Gilles Muller, Luis R. Rodriguez, Michal Marek, Nicolas Palix

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]



On Wed, 31 Jan 2018, SF Markus Elfring wrote:

> > I removed the blank line at EOF,
> > then applied to linux-kbuild/misc.
>
> I have taken another look at this script for the semantic patch language.
> I imagined that I could refactor the shown SmPL disjunctions a bit.
> But I noticed then that these SmPL rules contain a development mistake.
>
> The deletion for a call of the function “memset” depends on the specification
> that a size determination is passed by the expression “E1”.
> The function “kmem_cache_alloc” was specified despite of the technical detail
> that this function does not get a parameter passed which would correspond
> to such a size information.
> https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=537659c08a7da298aa748854f65f2aa1f31b1378#n14
>
> Thus I suggest to remove it from the first two SmPL rules and omit the rule “r4”.
> Will the rule set be more consistent then?

If E1 is not bound by the kem_cache_alloc rule, then it will match
anything.  The user can check if it is appropriate.

Another option would be to use the type of the variable storing the result
of the call to compute the expected size.  Feel free to send a patch.

julia

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

* =?UTF-8?Q?Re=3A_=5Bv2=5D_Coccinelle=3A_zalloc-simple=3A_Delete_function_=E2=80=9Ckmem=5Fcache=5Fallo
@ 2018-01-31 17:38       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-31 17:38 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]



On Wed, 31 Jan 2018, SF Markus Elfring wrote:

> > I removed the blank line at EOF,
> > then applied to linux-kbuild/misc.
>
> I have taken another look at this script for the semantic patch language.
> I imagined that I could refactor the shown SmPL disjunctions a bit.
> But I noticed then that these SmPL rules contain a development mistake.
>
> The deletion for a call of the function “memset” depends on the specification
> that a size determination is passed by the expression “E1”.
> The function “kmem_cache_alloc” was specified despite of the technical detail
> that this function does not get a parameter passed which would correspond
> to such a size information.
> https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=537659c08a7da298aa748854f65f2aa1f31b1378#n14
>
> Thus I suggest to remove it from the first two SmPL rules and omit the rule “r4”.
> Will the rule set be more consistent then?

If E1 is not bound by the kem_cache_alloc rule, then it will match
anything.  The user can check if it is appropriate.

Another option would be to use the type of the variable storing the result
of the call to compute the expected size.  Feel free to send a patch.

julia

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

* [Cocci] [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules
@ 2018-01-31 17:38       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-01-31 17:38 UTC (permalink / raw)
  To: cocci



On Wed, 31 Jan 2018, SF Markus Elfring wrote:

> > I removed the blank line at EOF,
> > then applied to linux-kbuild/misc.
>
> I have taken another look at this script for the semantic patch language.
> I imagined that I could refactor the shown SmPL disjunctions a bit.
> But I noticed then that these SmPL rules contain a development mistake.
>
> The deletion for a call of the function ?memset? depends on the specification
> that a size determination is passed by the expression ?E1?.
> The function ?kmem_cache_alloc? was specified despite of the technical detail
> that this function does not get a parameter passed which would correspond
> to such a size information.
> https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=537659c08a7da298aa748854f65f2aa1f31b1378#n14
>
> Thus I suggest to remove it from the first two SmPL rules and omit the rule ?r4?.
> Will the rule set be more consistent then?

If E1 is not bound by the kem_cache_alloc rule, then it will match
anything.  The user can check if it is appropriate.

Another option would be to use the type of the variable storing the result
of the call to compute the expected size.  Feel free to send a patch.

julia

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

* Re: [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules
  2018-01-31 17:38       ` =?UTF-8?Q?Re=3A_=5Bv2=5D_Coccinelle=3A_zalloc-simple=3A_Delete_function_=E2=80=9Ckmem=5Fcache=5Fallo Julia Lawall
@ 2018-01-31 17:53         ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-31 17:53 UTC (permalink / raw)
  To: Julia Lawall, Masahiro Yamada, Himanshu Jha
  Cc: cocci, LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

>> Will the rule set be more consistent then?
> 
> If E1 is not bound by the kem_cache_alloc rule, then it will match anything.

How much was such a software behaviour intended by the discussed SmPL script?


> The user can check if it is appropriate.

How does such an information fit to expectations for safe source code analysis?


> Another option would be to use the type of the variable storing the result
> of the call to compute the expected size.

How would this suggestion help here?

Regards,
Markus

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

* Re: [v2] Coccinelle: zalloc-simple: Delete function  =?UTF-8?B?4oCca21lbV9jYWNoZV9hbGxvY
@ 2018-01-31 17:53         ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-01-31 17:53 UTC (permalink / raw)
  To: Julia Lawall, Masahiro Yamada, Himanshu Jha
  Cc: cocci, LKML, kernel-janitors, Gilles Muller, Luis R. Rodriguez,
	Michal Marek, Nicolas Palix

>> Will the rule set be more consistent then?
> 
> If E1 is not bound by the kem_cache_alloc rule, then it will match anything.

How much was such a software behaviour intended by the discussed SmPL script?


> The user can check if it is appropriate.

How does such an information fit to expectations for safe source code analysis?


> Another option would be to use the type of the variable storing the result
> of the call to compute the expected size.

How would this suggestion help here?

Regards,
Markus

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

* [PATCH] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
  2017-12-29 17:22   ` [Cocci] " Masahiro Yamada
@ 2018-02-01  9:35     ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-01  9:35 UTC (permalink / raw)
  To: cocci, Gilles Muller, Himanshu Jha, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 1 Feb 2018 10:20:47 +0100

The deletion for a call of the function "memset" depends on
the specification that a size determination is passed by
the expression "E1".
The function "kmem_cache_alloc" was specified despite of the technical
detail that this function does not get a parameter passed which would
correspond to such a size information.

Thus remove it from the first two SmPL rules and omit the rule "r4".

Link: https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=f26e52e08ab8e56f528ac14aa7929b3477de5616#n14
Fixes: 5e2d9da5b9ba350a4f13bd3b255be046bcf86465 ("Coccinelle: kzalloc-simple: Add all zero allocating functions")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +-----------------------
 1 file changed, 1 insertion(+), 40 deletions(-)

diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 92b20913055f..3bee6cdd99ea 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -34,7 +34,7 @@ statement S;
 @@
 
 * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
-  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
+  kmalloc_node(E1, ...)\|kmem_alloc(E1, ...)\|
   devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
   kvmalloc_node(E1,...)\);
   if ((x==NULL) || ...) S
@@ -88,15 +88,6 @@ statement S;
 - x = (T)kmalloc_node(E1,E2,E3);
 + x = (T)kzalloc_node(E1,E2,E3);
 |
-- x = kmem_cache_alloc(E3,E4);
-+ x = kmem_cache_zalloc(E3,E4);
-|
-- x = (T *)kmem_cache_alloc(E3,E4);
-+ x = kmem_cache_zalloc(E3,E4);
-|
-- x = (T)kmem_cache_alloc(E3,E4);
-+ x = (T)kmem_cache_zalloc(E3,E4);
-|
 - x = kmem_alloc(E1,E2);
 + x = kmem_zalloc(E1,E2);
 |
@@ -268,36 +259,6 @@ x << r3.x;
 msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
 coccilib.report.print_report(p[0], msg)
 
-//-----------------------------------------------------------------
-@r4 depends on org || report@
-type T, T2;
-expression x;
-expression E1,E2,E3;
-statement S;
-position p;
-@@
-
- x = (T)kmem_cache_alloc@p(E2,E3);
- if ((x==NULL) || ...) S
- memset((T2)x,0,E1);
-
-@script:python depends on org@
-p << r4.p;
-x << r4.x;
-@@
-
-msg="%s" % (x)
-msg_safe=msg.replace("[","@(").replace("]",")")
-coccilib.org.print_todo(p[0], msg_safe)
-
-@script:python depends on report@
-p << r4.p;
-x << r4.x;
-@@
-
-msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
-coccilib.report.print_report(p[0], msg)
-
 //-----------------------------------------------------------------
 @r5 depends on org || report@
 type T, T2;
-- 
2.16.1

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

* [PATCH] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
@ 2018-02-01  9:35     ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-01  9:35 UTC (permalink / raw)
  To: cocci, Gilles Muller, Himanshu Jha, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 1 Feb 2018 10:20:47 +0100

The deletion for a call of the function "memset" depends on
the specification that a size determination is passed by
the expression "E1".
The function "kmem_cache_alloc" was specified despite of the technical
detail that this function does not get a parameter passed which would
correspond to such a size information.

Thus remove it from the first two SmPL rules and omit the rule "r4".

Link: https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?idò6e52e08ab8e56f528ac14aa7929b3477de5616#n14
Fixes: 5e2d9da5b9ba350a4f13bd3b255be046bcf86465 ("Coccinelle: kzalloc-simple: Add all zero allocating functions")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +-----------------------
 1 file changed, 1 insertion(+), 40 deletions(-)

diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 92b20913055f..3bee6cdd99ea 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -34,7 +34,7 @@ statement S;
 @@
 
 * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
-  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
+  kmalloc_node(E1, ...)\|kmem_alloc(E1, ...)\|
   devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
   kvmalloc_node(E1,...)\);
   if ((x=NULL) || ...) S
@@ -88,15 +88,6 @@ statement S;
 - x = (T)kmalloc_node(E1,E2,E3);
 + x = (T)kzalloc_node(E1,E2,E3);
 |
-- x = kmem_cache_alloc(E3,E4);
-+ x = kmem_cache_zalloc(E3,E4);
-|
-- x = (T *)kmem_cache_alloc(E3,E4);
-+ x = kmem_cache_zalloc(E3,E4);
-|
-- x = (T)kmem_cache_alloc(E3,E4);
-+ x = (T)kmem_cache_zalloc(E3,E4);
-|
 - x = kmem_alloc(E1,E2);
 + x = kmem_zalloc(E1,E2);
 |
@@ -268,36 +259,6 @@ x << r3.x;
 msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
 coccilib.report.print_report(p[0], msg)
 
-//-----------------------------------------------------------------
-@r4 depends on org || report@
-type T, T2;
-expression x;
-expression E1,E2,E3;
-statement S;
-position p;
-@@
-
- x = (T)kmem_cache_alloc@p(E2,E3);
- if ((x=NULL) || ...) S
- memset((T2)x,0,E1);
-
-@script:python depends on org@
-p << r4.p;
-x << r4.x;
-@@
-
-msg="%s" % (x)
-msg_safe=msg.replace("[","@(").replace("]",")")
-coccilib.org.print_todo(p[0], msg_safe)
-
-@script:python depends on report@
-p << r4.p;
-x << r4.x;
-@@
-
-msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
-coccilib.report.print_report(p[0], msg)
-
 //-----------------------------------------------------------------
 @r5 depends on org || report@
 type T, T2;
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
  2018-02-01  9:35     ` SF Markus Elfring
  (?)
@ 2018-02-01  9:40       ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-02-01  9:40 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, LKML, kernel-janitors



On Thu, 1 Feb 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 1 Feb 2018 10:20:47 +0100
>
> The deletion for a call of the function "memset" depends on
> the specification that a size determination is passed by
> the expression "E1".
> The function "kmem_cache_alloc" was specified despite of the technical
> detail that this function does not get a parameter passed which would
> correspond to such a size information.
>
> Thus remove it from the first two SmPL rules and omit the rule "r4".

Nack.  It should be supported by the size determined in another way.

julia

> Link: https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=f26e52e08ab8e56f528ac14aa7929b3477de5616#n14
> Fixes: 5e2d9da5b9ba350a4f13bd3b255be046bcf86465 ("Coccinelle: kzalloc-simple: Add all zero allocating functions")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +-----------------------
>  1 file changed, 1 insertion(+), 40 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> index 92b20913055f..3bee6cdd99ea 100644
> --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> @@ -34,7 +34,7 @@ statement S;
>  @@
>
>  * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
> -  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
> +  kmalloc_node(E1, ...)\|kmem_alloc(E1, ...)\|
>    devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
>    kvmalloc_node(E1,...)\);
>    if ((x==NULL) || ...) S
> @@ -88,15 +88,6 @@ statement S;
>  - x = (T)kmalloc_node(E1,E2,E3);
>  + x = (T)kzalloc_node(E1,E2,E3);
>  |
> -- x = kmem_cache_alloc(E3,E4);
> -+ x = kmem_cache_zalloc(E3,E4);
> -|
> -- x = (T *)kmem_cache_alloc(E3,E4);
> -+ x = kmem_cache_zalloc(E3,E4);
> -|
> -- x = (T)kmem_cache_alloc(E3,E4);
> -+ x = (T)kmem_cache_zalloc(E3,E4);
> -|
>  - x = kmem_alloc(E1,E2);
>  + x = kmem_zalloc(E1,E2);
>  |
> @@ -268,36 +259,6 @@ x << r3.x;
>  msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
>  coccilib.report.print_report(p[0], msg)
>
> -//-----------------------------------------------------------------
> -@r4 depends on org || report@
> -type T, T2;
> -expression x;
> -expression E1,E2,E3;
> -statement S;
> -position p;
> -@@
> -
> - x = (T)kmem_cache_alloc@p(E2,E3);
> - if ((x==NULL) || ...) S
> - memset((T2)x,0,E1);
> -
> -@script:python depends on org@
> -p << r4.p;
> -x << r4.x;
> -@@
> -
> -msg="%s" % (x)
> -msg_safe=msg.replace("[","@(").replace("]",")")
> -coccilib.org.print_todo(p[0], msg_safe)
> -
> -@script:python depends on report@
> -p << r4.p;
> -x << r4.x;
> -@@
> -
> -msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
> -coccilib.report.print_report(p[0], msg)
> -
>  //-----------------------------------------------------------------
>  @r5 depends on org || report@
>  type T, T2;
> --
> 2.16.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: [PATCH] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
@ 2018-02-01  9:40       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-02-01  9:40 UTC (permalink / raw)
  To: cocci



On Thu, 1 Feb 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 1 Feb 2018 10:20:47 +0100
>
> The deletion for a call of the function "memset" depends on
> the specification that a size determination is passed by
> the expression "E1".
> The function "kmem_cache_alloc" was specified despite of the technical
> detail that this function does not get a parameter passed which would
> correspond to such a size information.
>
> Thus remove it from the first two SmPL rules and omit the rule "r4".

Nack.  It should be supported by the size determined in another way.

julia

> Link: https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?idò6e52e08ab8e56f528ac14aa7929b3477de5616#n14
> Fixes: 5e2d9da5b9ba350a4f13bd3b255be046bcf86465 ("Coccinelle: kzalloc-simple: Add all zero allocating functions")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +-----------------------
>  1 file changed, 1 insertion(+), 40 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> index 92b20913055f..3bee6cdd99ea 100644
> --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> @@ -34,7 +34,7 @@ statement S;
>  @@
>
>  * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
> -  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
> +  kmalloc_node(E1, ...)\|kmem_alloc(E1, ...)\|
>    devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
>    kvmalloc_node(E1,...)\);
>    if ((x=NULL) || ...) S
> @@ -88,15 +88,6 @@ statement S;
>  - x = (T)kmalloc_node(E1,E2,E3);
>  + x = (T)kzalloc_node(E1,E2,E3);
>  |
> -- x = kmem_cache_alloc(E3,E4);
> -+ x = kmem_cache_zalloc(E3,E4);
> -|
> -- x = (T *)kmem_cache_alloc(E3,E4);
> -+ x = kmem_cache_zalloc(E3,E4);
> -|
> -- x = (T)kmem_cache_alloc(E3,E4);
> -+ x = (T)kmem_cache_zalloc(E3,E4);
> -|
>  - x = kmem_alloc(E1,E2);
>  + x = kmem_zalloc(E1,E2);
>  |
> @@ -268,36 +259,6 @@ x << r3.x;
>  msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
>  coccilib.report.print_report(p[0], msg)
>
> -//-----------------------------------------------------------------
> -@r4 depends on org || report@
> -type T, T2;
> -expression x;
> -expression E1,E2,E3;
> -statement S;
> -position p;
> -@@
> -
> - x = (T)kmem_cache_alloc@p(E2,E3);
> - if ((x=NULL) || ...) S
> - memset((T2)x,0,E1);
> -
> -@script:python depends on org@
> -p << r4.p;
> -x << r4.x;
> -@@
> -
> -msg="%s" % (x)
> -msg_safe=msg.replace("[","@(").replace("]",")")
> -coccilib.org.print_todo(p[0], msg_safe)
> -
> -@script:python depends on report@
> -p << r4.p;
> -x << r4.x;
> -@@
> -
> -msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
> -coccilib.report.print_report(p[0], msg)
> -
>  //-----------------------------------------------------------------
>  @r5 depends on org || report@
>  type T, T2;
> --
> 2.16.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [Cocci] [PATCH] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
@ 2018-02-01  9:40       ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-02-01  9:40 UTC (permalink / raw)
  To: cocci



On Thu, 1 Feb 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 1 Feb 2018 10:20:47 +0100
>
> The deletion for a call of the function "memset" depends on
> the specification that a size determination is passed by
> the expression "E1".
> The function "kmem_cache_alloc" was specified despite of the technical
> detail that this function does not get a parameter passed which would
> correspond to such a size information.
>
> Thus remove it from the first two SmPL rules and omit the rule "r4".

Nack.  It should be supported by the size determined in another way.

julia

> Link: https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=f26e52e08ab8e56f528ac14aa7929b3477de5616#n14
> Fixes: 5e2d9da5b9ba350a4f13bd3b255be046bcf86465 ("Coccinelle: kzalloc-simple: Add all zero allocating functions")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +-----------------------
>  1 file changed, 1 insertion(+), 40 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> index 92b20913055f..3bee6cdd99ea 100644
> --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> @@ -34,7 +34,7 @@ statement S;
>  @@
>
>  * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
> -  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
> +  kmalloc_node(E1, ...)\|kmem_alloc(E1, ...)\|
>    devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\|
>    kvmalloc_node(E1,...)\);
>    if ((x==NULL) || ...) S
> @@ -88,15 +88,6 @@ statement S;
>  - x = (T)kmalloc_node(E1,E2,E3);
>  + x = (T)kzalloc_node(E1,E2,E3);
>  |
> -- x = kmem_cache_alloc(E3,E4);
> -+ x = kmem_cache_zalloc(E3,E4);
> -|
> -- x = (T *)kmem_cache_alloc(E3,E4);
> -+ x = kmem_cache_zalloc(E3,E4);
> -|
> -- x = (T)kmem_cache_alloc(E3,E4);
> -+ x = (T)kmem_cache_zalloc(E3,E4);
> -|
>  - x = kmem_alloc(E1,E2);
>  + x = kmem_zalloc(E1,E2);
>  |
> @@ -268,36 +259,6 @@ x << r3.x;
>  msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x)
>  coccilib.report.print_report(p[0], msg)
>
> -//-----------------------------------------------------------------
> - at r4 depends on org || report@
> -type T, T2;
> -expression x;
> -expression E1,E2,E3;
> -statement S;
> -position p;
> -@@
> -
> - x = (T)kmem_cache_alloc at p(E2,E3);
> - if ((x==NULL) || ...) S
> - memset((T2)x,0,E1);
> -
> - at script:python depends on org@
> -p << r4.p;
> -x << r4.x;
> -@@
> -
> -msg="%s" % (x)
> -msg_safe=msg.replace("[","@(").replace("]",")")
> -coccilib.org.print_todo(p[0], msg_safe)
> -
> - at script:python depends on report@
> -p << r4.p;
> -x << r4.x;
> -@@
> -
> -msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
> -coccilib.report.print_report(p[0], msg)
> -
>  //-----------------------------------------------------------------
>  @r5 depends on org || report@
>  type T, T2;
> --
> 2.16.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
  2018-02-01  9:40       ` Julia Lawall
@ 2018-02-01 10:17         ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-01 10:17 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> The function "kmem_cache_alloc" was specified despite of the technical
>> detail that this function does not get a parameter passed which would
>> correspond to such a size information.
>>
>> Thus remove it from the first two SmPL rules and omit the rule "r4".
> 
> Nack.

I find such a rejection surprising once more.


> It should be supported by the size determined in another way.

I am curious on how our different views could be clarified further
for this special software situation.

* Do we agree that a proper size determination is essential for every
  condition in the discussed SmPL rules together with forwarding
  this information?

* How can a name be ever relevant (within the published SmPL approach)
  for a function when it was designed in the way that it should generally
  work without a size parameter?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
@ 2018-02-01 10:17         ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-01 10:17 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> The function "kmem_cache_alloc" was specified despite of the technical
>> detail that this function does not get a parameter passed which would
>> correspond to such a size information.
>>
>> Thus remove it from the first two SmPL rules and omit the rule "r4".
> 
> Nack.

I find such a rejection surprising once more.


> It should be supported by the size determined in another way.

I am curious on how our different views could be clarified further
for this special software situation.

* Do we agree that a proper size determination is essential for every
  condition in the discussed SmPL rules together with forwarding
  this information?

* How can a name be ever relevant (within the published SmPL approach)
  for a function when it was designed in the way that it should generally
  work without a size parameter?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
  2018-02-01 10:17         ` SF Markus Elfring
  (?)
@ 2018-02-01 10:27           ` Julia Lawall
  -1 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-02-01 10:27 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: cocci, Gilles Muller, Himanshu Jha, Masahiro Yamada,
	Michal Marek, Nicolas Palix, LKML, kernel-janitors



On Thu, 1 Feb 2018, SF Markus Elfring wrote:

> >> The function "kmem_cache_alloc" was specified despite of the technical
> >> detail that this function does not get a parameter passed which would
> >> correspond to such a size information.
> >>
> >> Thus remove it from the first two SmPL rules and omit the rule "r4".
> >
> > Nack.
>
> I find such a rejection surprising once more.
>
>
> > It should be supported by the size determined in another way.
>
> I am curious on how our different views could be clarified further
> for this special software situation.
>
> * Do we agree that a proper size determination is essential for every
>   condition in the discussed SmPL rules together with forwarding
>   this information?

No.  I don't mind a few false positives.  The user can look at the answer
and see if it is a false positive or not.

Furthermore, I told you how to address this function so that the size
issue would be taken care of.  That is the patch that I would accept.

>
> * How can a name be ever relevant (within the published SmPL approach)
>   for a function when it was designed in the way that it should generally
>   work without a size parameter?

No idea what this means.

julia

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

* Re: Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
@ 2018-02-01 10:27           ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-02-01 10:27 UTC (permalink / raw)
  To: cocci



On Thu, 1 Feb 2018, SF Markus Elfring wrote:

> >> The function "kmem_cache_alloc" was specified despite of the technical
> >> detail that this function does not get a parameter passed which would
> >> correspond to such a size information.
> >>
> >> Thus remove it from the first two SmPL rules and omit the rule "r4".
> >
> > Nack.
>
> I find such a rejection surprising once more.
>
>
> > It should be supported by the size determined in another way.
>
> I am curious on how our different views could be clarified further
> for this special software situation.
>
> * Do we agree that a proper size determination is essential for every
>   condition in the discussed SmPL rules together with forwarding
>   this information?

No.  I don't mind a few false positives.  The user can look at the answer
and see if it is a false positive or not.

Furthermore, I told you how to address this function so that the size
issue would be taken care of.  That is the patch that I would accept.

>
> * How can a name be ever relevant (within the published SmPL approach)
>   for a function when it was designed in the way that it should generally
>   work without a size parameter?

No idea what this means.

julia

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

* [Cocci] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
@ 2018-02-01 10:27           ` Julia Lawall
  0 siblings, 0 replies; 79+ messages in thread
From: Julia Lawall @ 2018-02-01 10:27 UTC (permalink / raw)
  To: cocci



On Thu, 1 Feb 2018, SF Markus Elfring wrote:

> >> The function "kmem_cache_alloc" was specified despite of the technical
> >> detail that this function does not get a parameter passed which would
> >> correspond to such a size information.
> >>
> >> Thus remove it from the first two SmPL rules and omit the rule "r4".
> >
> > Nack.
>
> I find such a rejection surprising once more.
>
>
> > It should be supported by the size determined in another way.
>
> I am curious on how our different views could be clarified further
> for this special software situation.
>
> * Do we agree that a proper size determination is essential for every
>   condition in the discussed SmPL rules together with forwarding
>   this information?

No.  I don't mind a few false positives.  The user can look at the answer
and see if it is a false positive or not.

Furthermore, I told you how to address this function so that the size
issue would be taken care of.  That is the patch that I would accept.

>
> * How can a name be ever relevant (within the published SmPL approach)
>   for a function when it was designed in the way that it should generally
>   work without a size parameter?

No idea what this means.

julia

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

* Re: Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
  2018-02-01 10:27           ` Julia Lawall
@ 2018-02-01 11:00             ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-01 11:00 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> * Do we agree that a proper size determination is essential for every
>>   condition in the discussed SmPL rules together with forwarding
>>   this information?
> 
> No.  I don't mind a few false positives.

I have got other source code analysis expectations there.

This SmPL script contains the tag “Confidence: High”.


> The user can look at the answer and see if it is a false positive or not.

The situation is questionable because of a specific software design detail.

Unsafe source code search patterns could be stored under other script names
(or even different directories).
How do you think about to move the SmPL code (which I proposed for deletion)
to another script if you would insist to preserve it?


> Furthermore, I told you how to address this function so that the size
> issue would be taken care of.

You offered another bit of information.

I find your interpretation of this aspect also unclear at the moment.


> That is the patch that I would accept.

Are there any better development solutions left over?


>> * How can a name be ever relevant (within the published SmPL approach)
>>   for a function when it was designed in the way that it should generally
>>   work without a size parameter?
> 
> No idea what this means.

I am trying again to resolve corresponding communication difficulties.
Thus I suggest to take another look at the following SmPL code fragment.

…
  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
…
* memset((T2)x,0,E1);
…


How many constraints should be considered for function parameters here?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules
@ 2018-02-01 11:00             ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-01 11:00 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Gilles Muller, Himanshu Jha, Masahiro Yamada, Michal Marek,
	Nicolas Palix, LKML, kernel-janitors

>> * Do we agree that a proper size determination is essential for every
>>   condition in the discussed SmPL rules together with forwarding
>>   this information?
> 
> No.  I don't mind a few false positives.

I have got other source code analysis expectations there.

This SmPL script contains the tag “Confidence: High”.


> The user can look at the answer and see if it is a false positive or not.

The situation is questionable because of a specific software design detail.

Unsafe source code search patterns could be stored under other script names
(or even different directories).
How do you think about to move the SmPL code (which I proposed for deletion)
to another script if you would insist to preserve it?


> Furthermore, I told you how to address this function so that the size
> issue would be taken care of.

You offered another bit of information.

I find your interpretation of this aspect also unclear at the moment.


> That is the patch that I would accept.

Are there any better development solutions left over?


>> * How can a name be ever relevant (within the published SmPL approach)
>>   for a function when it was designed in the way that it should generally
>>   work without a size parameter?
> 
> No idea what this means.

I am trying again to resolve corresponding communication difficulties.
Thus I suggest to take another look at the following SmPL code fragment.

…
  kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
…
* memset((T2)x,0,E1);
…


How many constraints should be considered for function parameters here?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consistency for SmPL rules
  2018-02-01 10:27           ` Julia Lawall
@ 2018-02-03  7:22             ` SF Markus Elfring
  -1 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-03  7:22 UTC (permalink / raw)
  To: Julia Lawall, Himanshu Jha, Masahiro Yamada
  Cc: cocci, Gilles Muller, Michal Marek, Nicolas Palix, LKML, kernel-janitors

>> * Do we agree that a proper size determination is essential for every
>>   condition in the discussed SmPL rules together with forwarding
>>   this information?
> 
> No.  I don't mind a few false positives.

Do you care to split SmPL rules by their confidence category in such an use case?

Regards,
Markus

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

* Re: Coccinelle: zalloc-simple: Checking consistency for SmPL rules
@ 2018-02-03  7:22             ` SF Markus Elfring
  0 siblings, 0 replies; 79+ messages in thread
From: SF Markus Elfring @ 2018-02-03  7:22 UTC (permalink / raw)
  To: Julia Lawall, Himanshu Jha, Masahiro Yamada
  Cc: cocci, Gilles Muller, Michal Marek, Nicolas Palix, LKML, kernel-janitors

>> * Do we agree that a proper size determination is essential for every
>>   condition in the discussed SmPL rules together with forwarding
>>   this information?
> 
> No.  I don't mind a few false positives.

Do you care to split SmPL rules by their confidence category in such an use case?

Regards,
Markus

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

end of thread, other threads:[~2018-02-03  7:23 UTC | newest]

Thread overview: 79+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-26 21:40 [PATCH v2] Coccinelle: kzalloc-simple: Add all zero allocating functions Himanshu Jha
2017-12-26 21:40 ` [Cocci] " Himanshu Jha
2017-12-26 21:52 ` Julia Lawall
2017-12-26 21:52   ` [Cocci] " Julia Lawall
2017-12-29 17:22 ` Masahiro Yamada
2017-12-29 17:22   ` [Cocci] " Masahiro Yamada
2017-12-29 17:49   ` Julia Lawall
2017-12-29 17:49     ` [Cocci] " Julia Lawall
2018-01-02 14:25   ` Rename the SmPL script “kzalloc-….cocci”? SF Markus Elfring
2018-01-02 14:25     ` SF Markus Elfring
2018-01-02 14:28     ` Julia Lawall
2018-01-02 14:28       ` [Cocci] " Julia Lawall
2018-01-02 14:28       ` Julia Lawall
2018-01-02 14:38       ` SF Markus Elfring
2018-01-02 14:38         ` SF Markus Elfring
2018-01-02 14:43         ` Julia Lawall
2018-01-02 14:43           ` [Cocci] " Julia Lawall
2018-01-02 14:43           ` Julia Lawall
2018-01-02 15:00           ` SF Markus Elfring
2018-01-02 15:00             ` SF Markus Elfring
2018-01-08  9:55           ` SF Markus Elfring
2018-01-08  9:55             ` SF Markus Elfring
2018-01-03 11:55       ` [PATCH] Coccinelle: Rename the script for a transformation of memory allocations SF Markus Elfring
2018-01-03 11:55         ` SF Markus Elfring
2018-01-03 12:02         ` Julia Lawall
2018-01-03 12:02           ` [Cocci] " Julia Lawall
2018-01-03 12:02           ` Julia Lawall
2018-01-03 12:13           ` SF Markus Elfring
2018-01-03 12:13             ` SF Markus Elfring
2018-01-03 12:17             ` Julia Lawall
2018-01-03 12:17               ` [Cocci] " Julia Lawall
2018-01-03 12:17               ` Julia Lawall
2018-01-03 12:31               ` SF Markus Elfring
2018-01-03 12:31                 ` SF Markus Elfring
2018-01-03 12:40                 ` Julia Lawall
2018-01-03 12:40                   ` [Cocci] " Julia Lawall
2018-01-03 12:40                   ` Julia Lawall
2018-01-03 12:45                   ` SF Markus Elfring
2018-01-03 12:45                     ` SF Markus Elfring
2018-01-04  8:36                   ` SF Markus Elfring
2018-01-04  8:36                     ` SF Markus Elfring
2018-01-04  8:54                     ` Julia Lawall
2018-01-04  8:54                       ` [Cocci] " Julia Lawall
2018-01-04  8:54                       ` Julia Lawall
2018-01-04  9:43                       ` SF Markus Elfring
2018-01-04  9:43                         ` SF Markus Elfring
2018-01-17 16:47   ` [v2] Coccinelle: zalloc-simple: Safer transformations with SmPL SF Markus Elfring
2018-01-17 16:47     ` SF Markus Elfring
2018-01-19 16:14   ` Coccinelle: zalloc-simple: Checking consequences from the usage of at signs in Python strings SF Markus Elfring
2018-01-19 16:14     ` SF Markus Elfring
2018-01-19 16:18     ` Julia Lawall
2018-01-19 16:18       ` [Cocci] " Julia Lawall
2018-01-19 16:18       ` Julia Lawall
2018-01-19 16:43       ` SF Markus Elfring
2018-01-19 16:43         ` SF Markus Elfring
2018-01-24  8:41       ` SF Markus Elfring
2018-01-24  8:41         ` SF Markus Elfring
2018-01-31 17:28   ` [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules SF Markus Elfring
2018-01-31 17:28     ` [Cocci] " SF Markus Elfring
2018-01-31 17:28     ` [v2] Coccinelle: zalloc-simple: Delete function =?UTF-8?B?4oCca21lbV9jYWNoZV9hbGxvY SF Markus Elfring
2018-01-31 17:38     ` [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules Julia Lawall
2018-01-31 17:38       ` [Cocci] " Julia Lawall
2018-01-31 17:38       ` =?UTF-8?Q?Re=3A_=5Bv2=5D_Coccinelle=3A_zalloc-simple=3A_Delete_function_=E2=80=9Ckmem=5Fcache=5Fallo Julia Lawall
2018-01-31 17:53       ` [v2] Coccinelle: zalloc-simple: Delete function “kmem_cache_alloc” from SmPL rules SF Markus Elfring
2018-01-31 17:53         ` [v2] Coccinelle: zalloc-simple: Delete function =?UTF-8?B?4oCca21lbV9jYWNoZV9hbGxvY SF Markus Elfring
2018-02-01  9:35   ` [PATCH] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules SF Markus Elfring
2018-02-01  9:35     ` SF Markus Elfring
2018-02-01  9:40     ` Julia Lawall
2018-02-01  9:40       ` [Cocci] " Julia Lawall
2018-02-01  9:40       ` Julia Lawall
2018-02-01 10:17       ` SF Markus Elfring
2018-02-01 10:17         ` SF Markus Elfring
2018-02-01 10:27         ` Julia Lawall
2018-02-01 10:27           ` [Cocci] " Julia Lawall
2018-02-01 10:27           ` Julia Lawall
2018-02-01 11:00           ` SF Markus Elfring
2018-02-01 11:00             ` SF Markus Elfring
2018-02-03  7:22           ` Coccinelle: zalloc-simple: Checking consistency for " SF Markus Elfring
2018-02-03  7:22             ` SF Markus Elfring

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.