* [PATCH 0/4] Add a Coccinelle front-end script
@ 2010-04-26 21:11 Nicolas Palix
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
` (4 more replies)
0 siblings, 5 replies; 25+ messages in thread
From: Nicolas Palix @ 2010-04-26 21:11 UTC (permalink / raw)
To: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, Nicolas Palix,
linux-kernel, linux-kbuild, cocci
New targets are added (coccicheck-<mode>) to call the spatch front-end
in the 'scripts' directory with the <mode> argument.
Four modes are defined: report, patch, context, and org.
'report' mode generates a list in the following format:
file:line:column-column: message
'patch' mode proposes a generic fix, when possible.
'context' mode highlights lines of interest and their context
in a diff-like style.
'org' mode generates a report in the Org mode format of Emacs.
Three semantic patches, with a low rate of false positives, are also added.
Other semantic patches will be propose later.
Nicolas Palix (4):
Add targets to use the Coccinelle checker
Add scripts/smpl/drop_kmalloc_cast.cocci
Add scripts/smpl/kzalloc-simple.cocci
Add scripts/smpl/resource_size.cocci
MAINTAINERS | 10 +++
Makefile | 9 +++
scripts/smpl/drop_kmalloc_cast.cocci | 74 +++++++++++++++++++++++++
scripts/smpl/kzalloc-simple.cocci | 88 +++++++++++++++++++++++++++++
scripts/smpl/resource_size.cocci | 101 ++++++++++++++++++++++++++++++++++
scripts/spatch.sh | 14 +++++
6 files changed, 296 insertions(+), 0 deletions(-)
create mode 100644 scripts/smpl/drop_kmalloc_cast.cocci
create mode 100644 scripts/smpl/kzalloc-simple.cocci
create mode 100644 scripts/smpl/resource_size.cocci
create mode 100755 scripts/spatch.sh
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 21:11 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
@ 2010-04-26 21:11 ` Nicolas Palix
2010-04-26 21:37 ` Joe Perches
` (2 more replies)
2010-04-26 21:11 ` [PATCH 2/4] Add scripts/smpl/drop_kmalloc_cast.cocci Nicolas Palix
` (3 subsequent siblings)
4 siblings, 3 replies; 25+ messages in thread
From: Nicolas Palix @ 2010-04-26 21:11 UTC (permalink / raw)
To: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, Nicolas Palix,
linux-kernel, linux-kbuild, cocci
Four targets are added. Each one generates a different
output kind: context, patch, org, report.
Every SmPL file in 'scripts/smpl' is given to the spatch frontend
(located in the 'scripts' directory), and applied to the entire
source tree.
Signed-off-by: Nicolas Palix <npalix@diku.dk>
---
MAINTAINERS | 10 ++++++++++
Makefile | 9 +++++++++
scripts/spatch.sh | 14 ++++++++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
create mode 100755 scripts/spatch.sh
diff --git a/MAINTAINERS b/MAINTAINERS
index 3d29fa3..2aab763 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1533,6 +1533,16 @@ L: platform-driver-x86@vger.kernel.org
S: Supported
F: drivers/platform/x86/classmate-laptop.c
+COCCINELLE
+M: Julia Lawall <julia@diku.dk>
+M: Gilles Muller <Gilles.Muller@lip6.fr>
+M: Nicolas Palix <npalix@diku.dk>
+L: cocci@diku.dk
+W: http://coccinelle.lip6.fr/
+S: Supported
+F: scripts/smpl/
+F: scripts/spatch.sh
+
CODA FILE SYSTEM
M: Jan Harkes <jaharkes@cs.cmu.edu>
M: coda@cs.cmu.edu
diff --git a/Makefile b/Makefile
index 67c1001..293c88b 100644
--- a/Makefile
+++ b/Makefile
@@ -325,6 +325,7 @@ INSTALLKERNEL := installkernel
DEPMOD = /sbin/depmod
KALLSYMS = scripts/kallsyms
PERL = perl
+SPATCH = spatch
CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
@@ -1424,6 +1425,14 @@ versioncheck:
-name '*.[hcS]' -type f -print | sort \
| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
+coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
+ @echo "\nPlease, check for false positive in the output before submitting a patch.\n\n"\
+ "Take particularly attention when using the \"patch\" mode\n"\
+ "and carefully review the patch YOU are about to submit.\n"
+ @find $(srctree)/scripts/smpl/ \
+ -name '*.cocci' -type f \
+ -exec $(srctree)/scripts/spatch.sh $(SPATCH) $(@:coccicheck-%=%) \{} $(srctree) \;
+
namespacecheck:
$(PERL) $(srctree)/scripts/namespace.pl
diff --git a/scripts/spatch.sh b/scripts/spatch.sh
new file mode 100755
index 0000000..bdcca15
--- /dev/null
+++ b/scripts/spatch.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+SPATCH="$1"
+MODE="$2"
+COCCI="$3"
+DIR="$4"
+
+OPT=`grep "Option" $COCCI | cut -d':' -f2`
+FILE=`echo $COCCI | sed "s|$DIR/||"`
+
+echo Processing `basename $COCCI` with \"$OPT\"
+echo Message example to submit a patch:
+grep "^///" $COCCI | sed "s|///||" | sed "s|THISFILE|$FILE|"
+$SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR
--
1.6.3.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 2/4] Add scripts/smpl/drop_kmalloc_cast.cocci
2010-04-26 21:11 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
@ 2010-04-26 21:11 ` Nicolas Palix
2010-04-26 21:11 ` [PATCH 3/4] Add scripts/smpl/kzalloc-simple.cocci Nicolas Palix
` (2 subsequent siblings)
4 siblings, 0 replies; 25+ messages in thread
From: Nicolas Palix @ 2010-04-26 21:11 UTC (permalink / raw)
To: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, Nicolas Palix,
linux-kernel, linux-kbuild, cocci
The purpose of this semantic patch is to remove
useless casts, as mentioned in the Linux documentation.
See Chapter 14 in Documentation/CodingStyle for more information.
Signed-off-by: Nicolas Palix <npalix@diku.dk>
---
scripts/smpl/drop_kmalloc_cast.cocci | 74 ++++++++++++++++++++++++++++++++++
1 files changed, 74 insertions(+), 0 deletions(-)
create mode 100644 scripts/smpl/drop_kmalloc_cast.cocci
diff --git a/scripts/smpl/drop_kmalloc_cast.cocci b/scripts/smpl/drop_kmalloc_cast.cocci
new file mode 100644
index 0000000..fbd3950
--- /dev/null
+++ b/scripts/smpl/drop_kmalloc_cast.cocci
@@ -0,0 +1,74 @@
+///
+/// Casting (void *) value returned by kmalloc is useless
+/// as mentioned in Documentation/CodingStyle, Chap 14.
+///
+/// The semantic patch that makes this change is available
+/// in THISFILE.
+///
+/// More information about semantic patching is available at
+/// http://coccinelle.lip6.fr/
+///
+// Confidence: High
+// Copyright: 2009,2010 Nicolas Palix, DIKU. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options: -no_includes -include_headers
+//
+// Keywords: kmalloc, kzalloc, kcalloc
+// Version min: < 2.6.12 kmalloc
+// Version min: < 2.6.12 kcalloc
+// Version min: 2.6.14 kzalloc
+// Version max: *
+//
+
+virtual context
+virtual patch
+virtual org
+virtual report
+
+//----------------------------------------------------------
+// For context mode
+//----------------------------------------------------------
+
+@depends on context@
+type T;
+@@
+
+* (T *)
+ \(kmalloc\|kzalloc\|kcalloc\)(...)
+
+//----------------------------------------------------------
+// For patch mode
+//----------------------------------------------------------
+
+@depends on patch@
+type T;
+@@
+
+- (T *)
+ \(kmalloc\|kzalloc\|kcalloc\)(...)
+
+//----------------------------------------------------------
+// For org and report mode
+//----------------------------------------------------------
+
+@r depends on org || report@
+type T;
+position p;
+@@
+
+ (T@p *)\(kmalloc\|kzalloc\|kcalloc\)(...)
+
+@script:python depends on org@
+p << r.p;
+t << r.T;
+@@
+
+coccilib.org.print_safe_todo(p[0], t)
+
+@script:python depends on report@
+p << r.p;
+t << r.T;
+@@
+
+msg="WARNING: casting value returned by k[cmz]alloc to (%s *) is useless." % (t)
+coccilib.report.print_report(p[0], msg)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 3/4] Add scripts/smpl/kzalloc-simple.cocci
2010-04-26 21:11 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-04-26 21:11 ` [PATCH 2/4] Add scripts/smpl/drop_kmalloc_cast.cocci Nicolas Palix
@ 2010-04-26 21:11 ` Nicolas Palix
2010-04-26 21:11 ` [PATCH 4/4] Add scripts/smpl/resource_size.cocci Nicolas Palix
2010-04-27 12:50 ` [PATCH 0/4] Add a Coccinelle front-end script Wolfram Sang
4 siblings, 0 replies; 25+ messages in thread
From: Nicolas Palix @ 2010-04-26 21:11 UTC (permalink / raw)
To: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, Nicolas Palix,
linux-kernel, linux-kbuild, cocci
This semantic patch replaces a pair of calls to kmalloc and memset
by a single call to kzalloc.
It only looks for simple cases to improve the confidence.
Signed-off-by: Nicolas Palix <npalix@diku.dk>
---
scripts/smpl/kzalloc-simple.cocci | 88 +++++++++++++++++++++++++++++++++++++
1 files changed, 88 insertions(+), 0 deletions(-)
create mode 100644 scripts/smpl/kzalloc-simple.cocci
diff --git a/scripts/smpl/kzalloc-simple.cocci b/scripts/smpl/kzalloc-simple.cocci
new file mode 100644
index 0000000..d4e1b25
--- /dev/null
+++ b/scripts/smpl/kzalloc-simple.cocci
@@ -0,0 +1,88 @@
+///
+/// kzalloc should be used rather than kmalloc followed by memset 0
+///
+/// The semantic patch that makes this change is available
+/// in THISFILE.
+///
+/// More information about semantic patching is available at
+/// http://coccinelle.lip6.fr/
+///
+// Confidence: High
+// Copyright: (C) 2009-2010 Gilles Muller, Julia Lawall, Nicolas Palix, EMN, DIKU. GPLv2.
+// URL: http://coccinelle.lip6.fr/rules/kzalloc.html
+// Options: -no_includes -include_headers
+//
+// Keywords: kmalloc, kzalloc
+// Version min: < 12 kmalloc
+// Version min: 14 kzalloc
+// Version max: *
+//
+
+virtual context
+virtual patch
+virtual org
+virtual report
+
+//----------------------------------------------------------
+// For context mode
+//----------------------------------------------------------
+
+@depends on context@
+type T, T2;
+expression x;
+expression E1,E2;
+statement S;
+@@
+
+* x = (T)kmalloc(E1,E2);
+ if ((x==NULL) || ...) S
+* memset((T2)x,0,E1);
+
+//----------------------------------------------------------
+// For patch mode
+//----------------------------------------------------------
+
+@depends on patch@
+type T, T2;
+expression x;
+expression E1,E2;
+statement S;
+@@
+
+- x = (T)kmalloc(E1,E2);
++ x = kzalloc(E1,E2);
+ if ((x==NULL) || ...) S
+- memset((T2)x,0,E1);
+
+//----------------------------------------------------------
+// For org mode
+//----------------------------------------------------------
+
+@r depends on org || report@
+type T, T2;
+expression x;
+expression E1,E2;
+statement S;
+position p;
+@@
+
+ x = (T)kmalloc@p(E1,E2);
+ if ((x==NULL) || ...) S
+ memset((T2)x,0,E1);
+
+@script:python depends on org@
+p << r.p;
+x << r.x;
+@@
+
+msg="%s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r.p;
+x << r.x;
+@@
+
+msg="WARNING: kzalloc should be used for %s, instead of kmalloc/memset" % (x)
+coccilib.report.print_report(p[0], msg_safe)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 4/4] Add scripts/smpl/resource_size.cocci
2010-04-26 21:11 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
` (2 preceding siblings ...)
2010-04-26 21:11 ` [PATCH 3/4] Add scripts/smpl/kzalloc-simple.cocci Nicolas Palix
@ 2010-04-26 21:11 ` Nicolas Palix
2010-04-27 12:50 ` [PATCH 0/4] Add a Coccinelle front-end script Wolfram Sang
4 siblings, 0 replies; 25+ messages in thread
From: Nicolas Palix @ 2010-04-26 21:11 UTC (permalink / raw)
To: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, Nicolas Palix,
linux-kernel, linux-kbuild, cocci
This semantic patch replaces explicit computations
of resource size by a call to resource_size.
Signed-off-by: Nicolas Palix <npalix@diku.dk>
---
scripts/smpl/resource_size.cocci | 101 ++++++++++++++++++++++++++++++++++++++
1 files changed, 101 insertions(+), 0 deletions(-)
create mode 100644 scripts/smpl/resource_size.cocci
diff --git a/scripts/smpl/resource_size.cocci b/scripts/smpl/resource_size.cocci
new file mode 100644
index 0000000..e5e24ac
--- /dev/null
+++ b/scripts/smpl/resource_size.cocci
@@ -0,0 +1,101 @@
+///
+/// Use resource_size function on resource object
+/// instead of explicit computation.
+///
+/// The semantic patch that makes this change is available
+/// in THISFILE.
+///
+/// More information about semantic patching is available at
+/// http://coccinelle.lip6.fr/
+///
+// Confidence: High
+// Copyright: (C) 2009, 2010 Nicolas Palix, DIKU. GPLv2.
+// Copyright: (C) 2009, 2010 Julia Lawall, DIKU. GPLv2.
+// Copyright: (C) 2009, 2010 Gilles Muller, EMN. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options:
+//
+// Keywords: resource_size
+// Version min: 2.6.27 resource_size
+// Version max: *
+//
+
+virtual context
+virtual patch
+virtual org
+virtual report
+
+//----------------------------------------------------------
+// For context mode
+//----------------------------------------------------------
+
+@r_context depends on context && !patch && !org@
+struct resource *res;
+@@
+
+* (res->end - res->start) + 1
+
+//----------------------------------------------------------
+// For patch mode
+//----------------------------------------------------------
+
+@r_patch depends on !context && patch && !org@
+struct resource *res;
+@@
+
+- (res->end - res->start) + 1
++ resource_size(res)
+
+//----------------------------------------------------------
+// For org mode
+//----------------------------------------------------------
+
+
+@r_org depends on !context && !patch && (org || report)@
+struct resource *res;
+position p;
+@@
+
+ (res->end@p - res->start) + 1
+
+@rbad_org depends on !context && !patch && (org || report)@
+struct resource *res;
+position p != r_org.p;
+@@
+
+ res->end@p - res->start
+
+@script:python depends on org@
+p << r_org.p;
+x << r_org.res;
+@@
+
+msg="ERROR with %s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << r_org.p;
+x << r_org.res;
+@@
+
+msg="ERROR: Missing resource_size with %s" % (x)
+coccilib.report.print_report(p[0], msg)
+
+@script:python depends on org@
+p << rbad_org.p;
+x << rbad_org.res;
+@@
+
+msg="WARNING with %s" % (x)
+msg_safe=msg.replace("[","@(").replace("]",")")
+coccilib.org.print_todo(p[0], msg_safe)
+
+@script:python depends on report@
+p << rbad_org.p;
+x << rbad_org.res;
+@@
+
+msg="WARNING: Suspicious code. resource_size is maybe missing with %s" % (x)
+coccilib.report.print_report(p[0], msg)
+
--
1.6.3.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
@ 2010-04-26 21:37 ` Joe Perches
2010-04-26 22:20 ` Nicolas Palix
2010-04-27 12:53 ` Wolfram Sang
2010-04-27 20:24 ` Sam Ravnborg
2 siblings, 1 reply; 25+ messages in thread
From: Joe Perches @ 2010-04-26 21:37 UTC (permalink / raw)
To: Nicolas Palix
Cc: Andrew Morton, David S. Miller, Michal Marek, Sam Ravnborg,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci
I like the concept and believe the kernel tree is a better
repository for these scripts than an external website.
On Mon, 2010-04-26 at 23:11 +0200, Nicolas Palix wrote:
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3d29fa3..2aab763 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1533,6 +1533,16 @@ L: platform-driver-x86@vger.kernel.org
> S: Supported
> F: drivers/platform/x86/classmate-laptop.c
>
> +COCCINELLE
COCCINELLE/Semantic Patches (SmPL)
> +coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
> + @echo "\nPlease, check for false positive in the output before submitting a patch.\n\n"\
Please check for false positives etc...
> + "Take particularly attention when using the \"patch\" mode\n"\
> + "and carefully review the patch YOU are about to submit.\n"
you
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 21:37 ` Joe Perches
@ 2010-04-26 22:20 ` Nicolas Palix
2010-04-26 22:23 ` Randy Dunlap
` (2 more replies)
0 siblings, 3 replies; 25+ messages in thread
From: Nicolas Palix @ 2010-04-26 22:20 UTC (permalink / raw)
To: Joe Perches
Cc: Andrew Morton, David S. Miller, Michal Marek, Sam Ravnborg,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci
On Monday 26 April 2010 23:37:01 Joe Perches wrote:
> I like the concept and believe the kernel tree is a better
> repository for these scripts than an external website.
Thank you for your feedback and support.
I attached an updated version of the patch 1/4.
>
> On Mon, 2010-04-26 at 23:11 +0200, Nicolas Palix wrote:
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 3d29fa3..2aab763 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -1533,6 +1533,16 @@ L: platform-driver-x86@vger.kernel.org
> > S: Supported
> > F: drivers/platform/x86/classmate-laptop.c
> >
> > +COCCINELLE
>
> COCCINELLE/Semantic Patches (SmPL)
>
> > +coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
> > + @echo "\nPlease, check for false positive in the output before submitting a patch.\n\n"\
>
> Please check for false positives etc...
>
> > + "Take particularly attention when using the \"patch\" mode\n"\
> > + "and carefully review the patch YOU are about to submit.\n"
>
> you
>
>
>
>
>From 98aba248f7cba64c771f3632c11b8188819c45a1 Mon Sep 17 00:00:00 2001
From: Nicolas Palix <npalix@diku.dk>
Date: Sun, 4 Apr 2010 15:42:57 +0200
Subject: [PATCH 1/4] Add targets to use the Coccinelle checker
Four targets are added. Each one generates a different
output kind: context, patch, org, report.
Every SmPL file in 'scripts/smpl' is given to the spatch frontend
(located in the 'scripts' directory), and applied to the entire
source tree.
Signed-off-by: Nicolas Palix <npalix@diku.dk>
---
MAINTAINERS | 10 ++++++++++
Makefile | 9 +++++++++
scripts/spatch.sh | 14 ++++++++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
create mode 100755 scripts/spatch.sh
diff --git a/MAINTAINERS b/MAINTAINERS
index 3d29fa3..2aab763 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1533,6 +1533,16 @@ L: platform-driver-x86@vger.kernel.org
S: Supported
F: drivers/platform/x86/classmate-laptop.c
+COCCINELLE/Semantic Patches (SmPL)
+M: Julia Lawall <julia@diku.dk>
+M: Gilles Muller <Gilles.Muller@lip6.fr>
+M: Nicolas Palix <npalix@diku.dk>
+L: cocci@diku.dk
+W: http://coccinelle.lip6.fr/
+S: Supported
+F: scripts/smpl/
+F: scripts/spatch.sh
+
CODA FILE SYSTEM
M: Jan Harkes <jaharkes@cs.cmu.edu>
M: coda@cs.cmu.edu
diff --git a/Makefile b/Makefile
index 67c1001..293c88b 100644
--- a/Makefile
+++ b/Makefile
@@ -325,6 +325,7 @@ INSTALLKERNEL := installkernel
DEPMOD = /sbin/depmod
KALLSYMS = scripts/kallsyms
PERL = perl
+SPATCH = spatch
CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
@@ -1424,6 +1425,14 @@ versioncheck:
-name '*.[hcS]' -type f -print | sort \
| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
+coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
+ @echo "\nPlease check for false positive in the output before submitting a patch.\n\n"\
+ "Take particularly attention when using the \"patch\" mode\n"\
+ "and carefully review the patch you are about to submit.\n"
+ @find $(srctree)/scripts/smpl/ \
+ -name '*.cocci' -type f \
+ -exec $(srctree)/scripts/spatch.sh $(SPATCH) $(@:coccicheck-%=%) \{} $(srctree) \;
+
namespacecheck:
$(PERL) $(srctree)/scripts/namespace.pl
diff --git a/scripts/spatch.sh b/scripts/spatch.sh
new file mode 100755
index 0000000..bdcca15
--- /dev/null
+++ b/scripts/spatch.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+SPATCH="$1"
+MODE="$2"
+COCCI="$3"
+DIR="$4"
+
+OPT=`grep "Option" $COCCI | cut -d':' -f2`
+FILE=`echo $COCCI | sed "s|$DIR/||"`
+
+echo Processing `basename $COCCI` with \"$OPT\"
+echo Message example to submit a patch:
+grep "^///" $COCCI | sed "s|///||" | sed "s|THISFILE|$FILE|"
+$SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR
--
1.6.3.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 22:20 ` Nicolas Palix
@ 2010-04-26 22:23 ` Randy Dunlap
2010-04-29 17:01 ` Roland Dreier
2010-04-27 12:40 ` Michal Marek
2010-04-27 13:01 ` Michal Marek
2 siblings, 1 reply; 25+ messages in thread
From: Randy Dunlap @ 2010-04-26 22:23 UTC (permalink / raw)
To: Nicolas Palix
Cc: Joe Perches, Andrew Morton, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, linux-kernel,
linux-kbuild, cocci
Nicolas Palix wrote:
> diff --git a/Makefile b/Makefile
> index 67c1001..293c88b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1424,6 +1425,14 @@ versioncheck:
> -name '*.[hcS]' -type f -print | sort \
> | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
>
> +coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
> + @echo "\nPlease check for false positive in the output before submitting a patch.\n\n"\
positives
> + "Take particularly attention when using the \"patch\" mode\n"\
particular
> + "and carefully review the patch you are about to submit.\n"
> + @find $(srctree)/scripts/smpl/ \
> + -name '*.cocci' -type f \
> + -exec $(srctree)/scripts/spatch.sh $(SPATCH) $(@:coccicheck-%=%) \{} $(srctree) \;
> +
> namespacecheck:
> $(PERL) $(srctree)/scripts/namespace.pl
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 22:20 ` Nicolas Palix
2010-04-26 22:23 ` Randy Dunlap
@ 2010-04-27 12:40 ` Michal Marek
2010-04-27 13:01 ` Michal Marek
2 siblings, 0 replies; 25+ messages in thread
From: Michal Marek @ 2010-04-27 12:40 UTC (permalink / raw)
To: Nicolas Palix
Cc: Joe Perches, Andrew Morton, David S. Miller, Sam Ravnborg,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci
Hi Nicolas,
On 27.4.2010 00:20, Nicolas Palix wrote:
> Four targets are added. Each one generates a different
> output kind: context, patch, org, report.
> Every SmPL file in 'scripts/smpl' is given to the spatch frontend
> (located in the 'scripts' directory), and applied to the entire
> source tree.
Cool!
> Signed-off-by: Nicolas Palix <npalix@diku.dk>
> ---
> MAINTAINERS | 10 ++++++++++
> Makefile | 9 +++++++++
> scripts/spatch.sh | 14 ++++++++++++++
> 3 files changed, 33 insertions(+), 0 deletions(-)
> create mode 100755 scripts/spatch.sh
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3d29fa3..2aab763 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1533,6 +1533,16 @@ L: platform-driver-x86@vger.kernel.org
> S: Supported
> F: drivers/platform/x86/classmate-laptop.c
>
> +COCCINELLE/Semantic Patches (SmPL)
> +M: Julia Lawall <julia@diku.dk>
> +M: Gilles Muller <Gilles.Muller@lip6.fr>
> +M: Nicolas Palix <npalix@diku.dk>
> +L: cocci@diku.dk
> +W: http://coccinelle.lip6.fr/
> +S: Supported
> +F: scripts/smpl/
> +F: scripts/spatch.sh
> +
> CODA FILE SYSTEM
> M: Jan Harkes <jaharkes@cs.cmu.edu>
> M: coda@cs.cmu.edu
> diff --git a/Makefile b/Makefile
> index 67c1001..293c88b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -325,6 +325,7 @@ INSTALLKERNEL := installkernel
> DEPMOD = /sbin/depmod
> KALLSYMS = scripts/kallsyms
> PERL = perl
> +SPATCH = spatch
> CHECK = sparse
>
> CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
> @@ -1424,6 +1425,14 @@ versioncheck:
> -name '*.[hcS]' -type f -print | sort \
> | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
>
> +coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
> + @echo "\nPlease check for false positive in the output before submitting a patch.\n\n"\
> + "Take particularly attention when using the \"patch\" mode\n"\
> + "and carefully review the patch you are about to submit.\n"
This should be echo -e in bash, but then it won't work in dash I guess.
So better use multiple echo commands. Also please add the targets to
'make help' text and add coccicheck-% to the no-dot-config-targets variable.
> + @find $(srctree)/scripts/smpl/ \
> + -name '*.cocci' -type f \
> + -exec $(srctree)/scripts/spatch.sh $(SPATCH) $(@:coccicheck-%=%) \{} $(srctree) \;
> +
Please use 'for file in $(srctree)/scripts/smpl/*.cocci; do ...', so
that the reports are in a defined order. Or do you plan to use
subdirectories below scripts/smpl?
> namespacecheck:
> $(PERL) $(srctree)/scripts/namespace.pl
>
> diff --git a/scripts/spatch.sh b/scripts/spatch.sh
> new file mode 100755
> index 0000000..bdcca15
> --- /dev/null
> +++ b/scripts/spatch.sh
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +SPATCH="$1"
> +MODE="$2"
> +COCCI="$3"
> +DIR="$4"
> +
> +OPT=`grep "Option" $COCCI | cut -d':' -f2`
> +FILE=`echo $COCCI | sed "s|$DIR/||"`
> +
> +echo Processing `basename $COCCI` with \"$OPT\"
> +echo Message example to submit a patch:
> +grep "^///" $COCCI | sed "s|///||" | sed "s|THISFILE|$FILE|"
echo "The semantic patch that makes this change is available"
echo "in $FILE"
Then you don't need to add the same comment to each of the *.cocci
files. Also is it necessary to advertise
"More information about semantic patching is available at
http://coccinelle.lip6.fr/"
before processing each *.cocci file? If you want the banner, you could
append it to the "Please check for false positives..." text printed once
in the beginning.
> +$SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR
You can also print the URL here if the spatch command is not available.
Michal
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-04-26 21:11 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
` (3 preceding siblings ...)
2010-04-26 21:11 ` [PATCH 4/4] Add scripts/smpl/resource_size.cocci Nicolas Palix
@ 2010-04-27 12:50 ` Wolfram Sang
2010-04-27 12:53 ` Julia Lawall
4 siblings, 1 reply; 25+ messages in thread
From: Wolfram Sang @ 2010-04-27 12:50 UTC (permalink / raw)
To: Nicolas Palix
Cc: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, linux-kernel,
linux-kbuild, cocci
[-- Attachment #1: Type: text/plain, Size: 868 bytes --]
On Mon, Apr 26, 2010 at 11:11:15PM +0200, Nicolas Palix wrote:
> New targets are added (coccicheck-<mode>) to call the spatch front-end
> in the 'scripts' directory with the <mode> argument.
>
> Four modes are defined: report, patch, context, and org.
>
> 'report' mode generates a list in the following format:
> file:line:column-column: message
>
> 'patch' mode proposes a generic fix, when possible.
>
> 'context' mode highlights lines of interest and their context
> in a diff-like style.
>
> 'org' mode generates a report in the Org mode format of Emacs.
So, as I understood all semantic patches have to support 'org'?
I think this makes submitting slightly more complicated...
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-04-27 12:50 ` [PATCH 0/4] Add a Coccinelle front-end script Wolfram Sang
@ 2010-04-27 12:53 ` Julia Lawall
0 siblings, 0 replies; 25+ messages in thread
From: Julia Lawall @ 2010-04-27 12:53 UTC (permalink / raw)
To: Wolfram Sang
Cc: Nicolas Palix, Andrew Morton, Joe Perches, David S. Miller,
Michal Marek, Sam Ravnborg, Gilles Muller, linux-kernel,
linux-kbuild, cocci
On Tue, 27 Apr 2010, Wolfram Sang wrote:
> On Mon, Apr 26, 2010 at 11:11:15PM +0200, Nicolas Palix wrote:
> > New targets are added (coccicheck-<mode>) to call the spatch front-end
> > in the 'scripts' directory with the <mode> argument.
> >
> > Four modes are defined: report, patch, context, and org.
> >
> > 'report' mode generates a list in the following format:
> > file:line:column-column: message
> >
> > 'patch' mode proposes a generic fix, when possible.
> >
> > 'context' mode highlights lines of interest and their context
> > in a diff-like style.
> >
> > 'org' mode generates a report in the Org mode format of Emacs.
>
> So, as I understood all semantic patches have to support 'org'?
> I think this makes submitting slightly more complicated...
No, this should not be the case. It just won't do anything if you request
org output and nothing is defined to produce org output.
julia
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-04-26 21:37 ` Joe Perches
@ 2010-04-27 12:53 ` Wolfram Sang
2010-04-27 20:24 ` Sam Ravnborg
2 siblings, 0 replies; 25+ messages in thread
From: Wolfram Sang @ 2010-04-27 12:53 UTC (permalink / raw)
To: Nicolas Palix
Cc: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Sam Ravnborg, Julia Lawall, Gilles Muller, linux-kernel,
linux-kbuild, cocci
[-- Attachment #1: Type: text/plain, Size: 3436 bytes --]
On Mon, Apr 26, 2010 at 11:11:16PM +0200, Nicolas Palix wrote:
> Four targets are added. Each one generates a different
> output kind: context, patch, org, report.
> Every SmPL file in 'scripts/smpl' is given to the spatch frontend
> (located in the 'scripts' directory), and applied to the entire
> source tree.
>
> Signed-off-by: Nicolas Palix <npalix@diku.dk>
> ---
> MAINTAINERS | 10 ++++++++++
> Makefile | 9 +++++++++
> scripts/spatch.sh | 14 ++++++++++++++
> 3 files changed, 33 insertions(+), 0 deletions(-)
> create mode 100755 scripts/spatch.sh
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3d29fa3..2aab763 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1533,6 +1533,16 @@ L: platform-driver-x86@vger.kernel.org
> S: Supported
> F: drivers/platform/x86/classmate-laptop.c
>
> +COCCINELLE
> +M: Julia Lawall <julia@diku.dk>
> +M: Gilles Muller <Gilles.Muller@lip6.fr>
> +M: Nicolas Palix <npalix@diku.dk>
> +L: cocci@diku.dk
> +W: http://coccinelle.lip6.fr/
> +S: Supported
> +F: scripts/smpl/
> +F: scripts/spatch.sh
> +
> CODA FILE SYSTEM
> M: Jan Harkes <jaharkes@cs.cmu.edu>
> M: coda@cs.cmu.edu
> diff --git a/Makefile b/Makefile
> index 67c1001..293c88b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -325,6 +325,7 @@ INSTALLKERNEL := installkernel
> DEPMOD = /sbin/depmod
> KALLSYMS = scripts/kallsyms
> PERL = perl
> +SPATCH = spatch
> CHECK = sparse
>
> CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
> @@ -1424,6 +1425,14 @@ versioncheck:
> -name '*.[hcS]' -type f -print | sort \
> | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
>
> +coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
> + @echo "\nPlease, check for false positive in the output before submitting a patch.\n\n"\
> + "Take particularly attention when using the \"patch\" mode\n"\
> + "and carefully review the patch YOU are about to submit.\n"
> + @find $(srctree)/scripts/smpl/ \
> + -name '*.cocci' -type f \
> + -exec $(srctree)/scripts/spatch.sh $(SPATCH) $(@:coccicheck-%=%) \{} $(srctree) \;
> +
> namespacecheck:
> $(PERL) $(srctree)/scripts/namespace.pl
>
> diff --git a/scripts/spatch.sh b/scripts/spatch.sh
> new file mode 100755
> index 0000000..bdcca15
> --- /dev/null
> +++ b/scripts/spatch.sh
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +SPATCH="$1"
> +MODE="$2"
> +COCCI="$3"
> +DIR="$4"
> +
> +OPT=`grep "Option" $COCCI | cut -d':' -f2`
> +FILE=`echo $COCCI | sed "s|$DIR/||"`
> +
> +echo Processing `basename $COCCI` with \"$OPT\"
> +echo Message example to submit a patch:
> +grep "^///" $COCCI | sed "s|///||" | sed "s|THISFILE|$FILE|"
I think the part containing "THISFILE" the patches should be generated here at
runtime. Also, the grep-command can be done via sed.
> +$SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 22:20 ` Nicolas Palix
2010-04-26 22:23 ` Randy Dunlap
2010-04-27 12:40 ` Michal Marek
@ 2010-04-27 13:01 ` Michal Marek
2 siblings, 0 replies; 25+ messages in thread
From: Michal Marek @ 2010-04-27 13:01 UTC (permalink / raw)
To: Nicolas Palix
Cc: Joe Perches, Andrew Morton, David S. Miller, Sam Ravnborg,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci
On 27.4.2010 00:20, Nicolas Palix wrote:
> +L: cocci@diku.dk
The list should be marked as "moderated for non-subscribers".
Michal
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-04-26 21:37 ` Joe Perches
2010-04-27 12:53 ` Wolfram Sang
@ 2010-04-27 20:24 ` Sam Ravnborg
2010-04-27 20:28 ` Sam Ravnborg
2 siblings, 1 reply; 25+ messages in thread
From: Sam Ravnborg @ 2010-04-27 20:24 UTC (permalink / raw)
To: Nicolas Palix
Cc: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci
Hej Nicolas.
On Mon, Apr 26, 2010 at 11:11:16PM +0200, Nicolas Palix wrote:
> Four targets are added. Each one generates a different
> output kind: context, patch, org, report.
> Every SmPL file in 'scripts/smpl' is given to the spatch frontend
> (located in the 'scripts' directory), and applied to the entire
> source tree.
For outsiders smpl does not rellate to coccinelle.
I suggest to consistently use the name of the tool in all places.
So smpl directory to be named coccinelle
SPATCH named coccinelle
spatch.sh named coccinelle.sh
etc.
This way we use one name for one thing. And not today where you
use three names for the same thing.
The files may be named *.smpl - because their home in
scripts/coccinelle/
will tell what they are used for.
[I regret that I used CHECK to name the sparse tool].
Sam
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-27 20:24 ` Sam Ravnborg
@ 2010-04-27 20:28 ` Sam Ravnborg
0 siblings, 0 replies; 25+ messages in thread
From: Sam Ravnborg @ 2010-04-27 20:28 UTC (permalink / raw)
To: Nicolas Palix
Cc: Andrew Morton, Joe Perches, David S. Miller, Michal Marek,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci
On Tue, Apr 27, 2010 at 10:24:03PM +0200, Sam Ravnborg wrote:
> Hej Nicolas.
>
> On Mon, Apr 26, 2010 at 11:11:16PM +0200, Nicolas Palix wrote:
> > Four targets are added. Each one generates a different
> > output kind: context, patch, org, report.
> > Every SmPL file in 'scripts/smpl' is given to the spatch frontend
> > (located in the 'scripts' directory), and applied to the entire
> > source tree.
>
> For outsiders smpl does not rellate to coccinelle.
>
> I suggest to consistently use the name of the tool in all places.
>
> So smpl directory to be named coccinelle
> SPATCH named coccinelle
> spatch.sh named coccinelle.sh
> etc.
>
> This way we use one name for one thing. And not today where you
> use three names for the same thing.
> The files may be named *.smpl - because their home in
>
> scripts/coccinelle/
>
> will tell what they are used for.
Looking again they are named *.cocci. So I confused myself on the smpl thing.
The point above consistent naming still holds.
Sam
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-26 22:23 ` Randy Dunlap
@ 2010-04-29 17:01 ` Roland Dreier
2010-04-30 21:07 ` Randy Dunlap
0 siblings, 1 reply; 25+ messages in thread
From: Roland Dreier @ 2010-04-29 17:01 UTC (permalink / raw)
To: Randy Dunlap
Cc: Nicolas Palix, Joe Perches, Andrew Morton, David S. Miller,
Michal Marek, Sam Ravnborg, Julia Lawall, Gilles Muller,
linux-kernel, linux-kbuild, cocci
> > + "Take particularly attention when using the \"patch\" mode\n"\
>
> particular
Actually, "take particular attention" is not particularly grammatical.
I might phrase this as
Be especially careful when using the "patch" mode to review the patch
you are about to submit.
- R.
--
Roland Dreier <rolandd@cisco.com> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/4] Add targets to use the Coccinelle checker
2010-04-29 17:01 ` Roland Dreier
@ 2010-04-30 21:07 ` Randy Dunlap
0 siblings, 0 replies; 25+ messages in thread
From: Randy Dunlap @ 2010-04-30 21:07 UTC (permalink / raw)
To: Roland Dreier
Cc: Nicolas Palix, Joe Perches, Andrew Morton, David S. Miller,
Michal Marek, Sam Ravnborg, Julia Lawall, Gilles Muller,
linux-kernel, linux-kbuild, cocci
On Thu, 29 Apr 2010 10:01:54 -0700 Roland Dreier wrote:
> > > + "Take particularly attention when using the \"patch\" mode\n"\
> >
> > particular
>
> Actually, "take particular attention" is not particularly grammatical.
> I might phrase this as
>
> Be especially careful when using the "patch" mode to review the patch
> you are about to submit.
Yes, or:
When using "patch" mode, carefully review the patch before submitting it.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 0/4] Add a Coccinelle front-end script
@ 2010-05-10 16:24 Nicolas Palix
2010-05-11 2:14 ` Andy Isaacson
2010-05-28 7:09 ` Joerg Roedel
0 siblings, 2 replies; 25+ messages in thread
From: Nicolas Palix @ 2010-05-10 16:24 UTC (permalink / raw)
To: Randy Dunlap, Roland Dreier, Joe Perches, Andrew Morton,
David S. Miller, Michal Marek, Sam Ravnborg, Julia Lawall,
Gilles Muller, linux-kernel, linux-kbuild, cocci, Wolfram Sang
Cc: Kernel Janitors, Nicolas Palix
New targets are added (coccicheck-<mode>) to call the 'coccinelle.sh' front-end
in the 'scripts' directory with the <mode> argument.
Four modes are defined: report, patch, context, and org.
'report' mode generates a list in the following format:
file:line:column-column: message
'patch' mode proposes a generic fix, when possible.
'context' mode highlights lines of interest and their context
in a diff-like style.
'org' mode generates a report in the Org mode format of Emacs.
Three semantic patches, with a low rate of false positives, are also
included. Other semantic patches will be provided later. Note that a
semantic patch does not need to define all four modes. As many semantic
patches may be proposed later, they are organized under sub-directories
of 'scripts/coccinelle/'.
We add a reference to the tool in the proposed changelog because it will
make the changelog easier to understand for someone who is not aware of
the tool.
To apply a single semantic patch, the user can define the COCCI environment
variable which gives the path to the semantic patch.
Nicolas Palix (4):
Add targets to use the Coccinelle checker
Add scripts/coccinelle/drop_kmalloc_cast.cocci
Add scripts/coccinelle/kzalloc-simple.cocci
Add scripts/coccinelle/resource_size.cocci
MAINTAINERS | 10 +++
Makefile | 20 +++++-
scripts/coccinelle.sh | 28 ++++++++
scripts/coccinelle/drop_kmalloc_cast.cocci | 68 ++++++++++++++++++++
scripts/coccinelle/kzalloc-simple.cocci | 83 ++++++++++++++++++++++++
scripts/coccinelle/resource_size.cocci | 94 ++++++++++++++++++++++++++++
6 files changed, 301 insertions(+), 2 deletions(-)
create mode 100755 scripts/coccinelle.sh
create mode 100644 scripts/coccinelle/drop_kmalloc_cast.cocci
create mode 100644 scripts/coccinelle/kzalloc-simple.cocci
create mode 100644 scripts/coccinelle/resource_size.cocci
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-05-10 16:24 Nicolas Palix
@ 2010-05-11 2:14 ` Andy Isaacson
2010-05-17 9:31 ` Wolfram Sang
2010-05-28 7:09 ` Joerg Roedel
1 sibling, 1 reply; 25+ messages in thread
From: Andy Isaacson @ 2010-05-11 2:14 UTC (permalink / raw)
To: Nicolas Palix
Cc: Randy Dunlap, Roland Dreier, Joe Perches, Andrew Morton,
David S. Miller, Michal Marek, Sam Ravnborg, Julia Lawall,
Gilles Muller, linux-kernel, linux-kbuild, cocci, Wolfram Sang,
Kernel Janitors
On Mon, May 10, 2010 at 06:24:23PM +0200, Nicolas Palix wrote:
> New targets are added (coccicheck-<mode>) to call the 'coccinelle.sh'
> front-end in the 'scripts' directory with the <mode> argument.
>
> Four modes are defined: report, patch, context, and org.
Please check-in this write-up somewhere (Documentation/README.coccinelle
perhaps?) along with information about how to get the required tools.
(Are they pacakged in Debian and/or Fedora? What versions are the
scripts tested against?)
Also I'd like to see a short example of how to use the framework. I've
read Val's spatch article (http://lwn.net/Articles/315686/) and it's
still a bit of a black art to me.
Thanks for the work!
-andy
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-05-11 2:14 ` Andy Isaacson
@ 2010-05-17 9:31 ` Wolfram Sang
0 siblings, 0 replies; 25+ messages in thread
From: Wolfram Sang @ 2010-05-17 9:31 UTC (permalink / raw)
To: Andy Isaacson
Cc: Nicolas Palix, Randy Dunlap, Roland Dreier, Joe Perches,
Andrew Morton, David S. Miller, Michal Marek, Sam Ravnborg,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci,
Kernel Janitors
[-- Attachment #1: Type: text/plain, Size: 957 bytes --]
On Mon, May 10, 2010 at 07:14:16PM -0700, Andy Isaacson wrote:
> On Mon, May 10, 2010 at 06:24:23PM +0200, Nicolas Palix wrote:
> > New targets are added (coccicheck-<mode>) to call the 'coccinelle.sh'
> > front-end in the 'scripts' directory with the <mode> argument.
> >
> > Four modes are defined: report, patch, context, and org.
>
> Please check-in this write-up somewhere (Documentation/README.coccinelle
> perhaps?)
I still haven't made my mind regarding these four modes; but if they are used,
they should be documented. ACK.
> Also I'd like to see a short example of how to use the framework. I've
> read Val's spatch article (http://lwn.net/Articles/315686/) and it's
> still a bit of a black art to me.
Something like this? :)
https://lwn.net/Articles/380835/
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-05-10 16:24 Nicolas Palix
2010-05-11 2:14 ` Andy Isaacson
@ 2010-05-28 7:09 ` Joerg Roedel
2010-05-28 7:25 ` Wolfram Sang
1 sibling, 1 reply; 25+ messages in thread
From: Joerg Roedel @ 2010-05-28 7:09 UTC (permalink / raw)
To: Nicolas Palix
Cc: Randy Dunlap, Roland Dreier, Joe Perches, Andrew Morton,
David S. Miller, Michal Marek, Sam Ravnborg, Julia Lawall,
Gilles Muller, linux-kernel, linux-kbuild, cocci, Wolfram Sang,
Kernel Janitors
On Mon, May 10, 2010 at 06:24:23PM +0200, Nicolas Palix wrote:
> Three semantic patches, with a low rate of false positives, are also
> included.
Is there a way to annotate false positives so that they do not produce
warnings over and over?
> Other semantic patches will be provided later. Note that a semantic
> patch does not need to define all four modes. As many semantic patches
> may be proposed later, they are organized under sub-directories of
> 'scripts/coccinelle/'.
Don't know how complex the coccinelle software itself is, but I think it
would make sense to ship it with the kernel-sources too. That together
with a README and everything is perfect :-)
Thanks for the great work, this should definitly be upstream.
Joerg
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-05-28 7:09 ` Joerg Roedel
@ 2010-05-28 7:25 ` Wolfram Sang
2010-05-28 7:31 ` Julia Lawall
0 siblings, 1 reply; 25+ messages in thread
From: Wolfram Sang @ 2010-05-28 7:25 UTC (permalink / raw)
To: Joerg Roedel
Cc: Nicolas Palix, Randy Dunlap, Roland Dreier, Joe Perches,
Andrew Morton, David S. Miller, Michal Marek, Sam Ravnborg,
Julia Lawall, Gilles Muller, linux-kernel, linux-kbuild, cocci,
Kernel Janitors
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
> Don't know how complex the coccinelle software itself is, but I think it
> would make sense to ship it with the kernel-sources too. That together
You can easily find out by browsing the homepage of coccinelle.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-05-28 7:25 ` Wolfram Sang
@ 2010-05-28 7:31 ` Julia Lawall
2010-05-28 7:39 ` walter harms
2010-05-28 9:15 ` Joerg Roedel
0 siblings, 2 replies; 25+ messages in thread
From: Julia Lawall @ 2010-05-28 7:31 UTC (permalink / raw)
To: Wolfram Sang
Cc: Joerg Roedel, Nicolas Palix, Randy Dunlap, Roland Dreier,
Joe Perches, Andrew Morton, David S. Miller, Michal Marek,
Sam Ravnborg, Gilles Muller, linux-kernel, linux-kbuild, cocci,
Kernel Janitors
On Fri, 28 May 2010, Wolfram Sang wrote:
> > Don't know how complex the coccinelle software itself is, but I think it
> > would make sense to ship it with the kernel-sources too. That together
>
> You can easily find out by browsing the homepage of coccinelle.
Over 100 000 lines of code.
julia
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-05-28 7:31 ` Julia Lawall
@ 2010-05-28 7:39 ` walter harms
2010-05-28 9:15 ` Joerg Roedel
1 sibling, 0 replies; 25+ messages in thread
From: walter harms @ 2010-05-28 7:39 UTC (permalink / raw)
To: Julia Lawall
Cc: Wolfram Sang, Joerg Roedel, Nicolas Palix, Randy Dunlap,
Roland Dreier, Joe Perches, Andrew Morton, David S. Miller,
Michal Marek, Sam Ravnborg, Gilles Muller, linux-kernel,
linux-kbuild, cocci, Kernel Janitors
Julia Lawall schrieb:
> On Fri, 28 May 2010, Wolfram Sang wrote:
>
>>> Don't know how complex the coccinelle software itself is, but I think it
>>> would make sense to ship it with the kernel-sources too. That together
>> You can easily find out by browsing the homepage of coccinelle.
>
> Over 100 000 lines of code.
>
> julia
> --
coccinelle is a great programm and should have its own repository.
I don not thing thats a clever idea to integrate it directly into
the kernel source tree. IMHO it would hinder the development of coccinelle
in the long term.
re,
wh
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/4] Add a Coccinelle front-end script
2010-05-28 7:31 ` Julia Lawall
2010-05-28 7:39 ` walter harms
@ 2010-05-28 9:15 ` Joerg Roedel
1 sibling, 0 replies; 25+ messages in thread
From: Joerg Roedel @ 2010-05-28 9:15 UTC (permalink / raw)
To: Julia Lawall
Cc: Wolfram Sang, Nicolas Palix, Randy Dunlap, Roland Dreier,
Joe Perches, Andrew Morton, David S. Miller, Michal Marek,
Sam Ravnborg, Gilles Muller, linux-kernel, linux-kbuild, cocci,
Kernel Janitors
On Fri, May 28, 2010 at 09:31:34AM +0200, Julia Lawall wrote:
> On Fri, 28 May 2010, Wolfram Sang wrote:
>
> > > Don't know how complex the coccinelle software itself is, but I think it
> > > would make sense to ship it with the kernel-sources too. That together
> >
> > You can easily find out by browsing the homepage of coccinelle.
>
> Over 100 000 lines of code.
I just noticed that distributions already ship it in their repositories.
So this its okay to keep it outside the kernel sources.
Joerg
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2010-05-28 9:15 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-26 21:11 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-04-26 21:37 ` Joe Perches
2010-04-26 22:20 ` Nicolas Palix
2010-04-26 22:23 ` Randy Dunlap
2010-04-29 17:01 ` Roland Dreier
2010-04-30 21:07 ` Randy Dunlap
2010-04-27 12:40 ` Michal Marek
2010-04-27 13:01 ` Michal Marek
2010-04-27 12:53 ` Wolfram Sang
2010-04-27 20:24 ` Sam Ravnborg
2010-04-27 20:28 ` Sam Ravnborg
2010-04-26 21:11 ` [PATCH 2/4] Add scripts/smpl/drop_kmalloc_cast.cocci Nicolas Palix
2010-04-26 21:11 ` [PATCH 3/4] Add scripts/smpl/kzalloc-simple.cocci Nicolas Palix
2010-04-26 21:11 ` [PATCH 4/4] Add scripts/smpl/resource_size.cocci Nicolas Palix
2010-04-27 12:50 ` [PATCH 0/4] Add a Coccinelle front-end script Wolfram Sang
2010-04-27 12:53 ` Julia Lawall
-- strict thread matches above, loose matches on Subject: below --
2010-05-10 16:24 Nicolas Palix
2010-05-11 2:14 ` Andy Isaacson
2010-05-17 9:31 ` Wolfram Sang
2010-05-28 7:09 ` Joerg Roedel
2010-05-28 7:25 ` Wolfram Sang
2010-05-28 7:31 ` Julia Lawall
2010-05-28 7:39 ` walter harms
2010-05-28 9:15 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).