summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-10-13 12:30:29 +0000
committerMichal Marek <mmarek@suse.cz>2010-10-13 12:30:29 +0000
commit7f3a6f6a16aa8c2b65f4f17ed13547e64b3a0647 (patch)
tree091a14de2e813a6b226fad30986f2cc08fdc4d2e /scripts
parent05834d0cad9afac483e9e569097d7736b288ddc7 (diff)
parent03ee0c42a77fbf60bfa6b0eacaff30ae4e19fce8 (diff)
Merge branch 'misc' into for-next
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/coccicheck30
-rw-r--r--scripts/coccinelle/free/kfree.cocci9
2 files changed, 28 insertions, 11 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck
index b8bcf1f7bed7..7529af15672d 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -16,6 +16,7 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
else
ONLINE=0
FLAGS="-very_quiet"
+ OPTIONS="-dir $srctree"
fi
if [ ! -x "$SPATCH" ]; then
@@ -25,11 +26,13 @@ fi
if [ "$MODE" = "" ] ; then
if [ "$ONLINE" = "0" ] ; then
- echo 'You have not explicitly specify the mode to use. Fallback to "report".'
+ echo 'You have not explicitly specified the mode to use. Using default "chain" mode.'
+ echo 'All available modes will be tried (in that order): patch, report, context, org'
echo 'You can specify the mode with "make coccicheck MODE=<mode>"'
- echo 'Available modes are: report, patch, context, org'
fi
- MODE="report"
+ MODE="chain"
+elif [ "$MODE" = "report" -o "$MODE" = "org" ] ; then
+ FLAGS="$FLAGS -no_show_diff"
fi
if [ "$ONLINE" = "0" ] ; then
@@ -52,10 +55,12 @@ coccinelle () {
FILE=`echo $COCCI | sed "s|$srctree/||"`
- echo "Processing `basename $COCCI` with option(s) \"$OPT\""
+ echo "Processing `basename $COCCI`"
+ echo "with option(s) \"$OPT\""
+ echo ''
echo 'Message example to submit a patch:'
- sed -e '/\/\/\//!d' -e 's|^///||' $COCCI
+ sed -ne 's|^///||p' $COCCI
echo ' The semantic patch that makes this change is available'
echo " in $FILE."
@@ -64,9 +69,20 @@ coccinelle () {
echo ' http://coccinelle.lip6.fr/'
echo ''
- $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1
+ if [ "`sed -ne 's|^//#||p' $COCCI`" ] ; then
+ echo 'Semantic patch information:'
+ sed -ne 's|^//#||p' $COCCI
+ echo ''
+ fi
+ fi
+
+ if [ "$MODE" = "chain" ] ; then
+ $SPATCH -D patch $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
+ $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
+ $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
+ $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
else
- $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
+ $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
fi
}
diff --git a/scripts/coccinelle/free/kfree.cocci b/scripts/coccinelle/free/kfree.cocci
index c13a5395707b..f9f79d9245ee 100644
--- a/scripts/coccinelle/free/kfree.cocci
+++ b/scripts/coccinelle/free/kfree.cocci
@@ -1,7 +1,8 @@
-/// Find a use after free. Values of variables may imply that some
-/// execution paths are not possible, resulting in false positives.
-/// Another source of false positives are macros such as
-/// SCTP_DBG_OBJCNT_DEC that do not actually evaluate their argument
+/// Find a use after free.
+//# Values of variables may imply that some
+//# execution paths are not possible, resulting in false positives.
+//# Another source of false positives are macros such as
+//# SCTP_DBG_OBJCNT_DEC that do not actually evaluate their argument
///
// Confidence: Moderate
// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.