aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/misc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-01-06scripts: coccinelle: boolinit: drop warnings on named constantsJulia Lawall1-0/+5
Coccinelle doesn't always have access to the values of named (#define) constants, and they may likely often be bound to true and false values anyway, resulting in false positives. So stop warning about them. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-17scripts: coccinelle: Correct warning messageJulia Lawall1-6/+6
"Assignment" requires the assigned value before the place that value is stored into. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-17scripts: coccinelle: only suggest true/false in files that already use themJulia Lawall1-10/+21
Some code may overall use 0 and 1, so don't introduce occasional uses of true and false in these cases. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-16Coccinelle: array_size: report even if include is missingJérémy Lefaure1-2/+2
Rule r does not depend on rule i (which is the include of linux/kernel.h) so the output should not depend on i in org and report mode. Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-17Merge tag 'kbuild-misc-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds2-18/+33
Pull Kbuild misc updates from Masahiro Yamada: - Clean up and fix RPM package build - Fix a warning in DEB package build - Improve coccicheck script - Improve some semantic patches * tag 'kbuild-misc-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: docs: dev-tools: coccinelle: delete out of date wiki reference coccinelle: orplus: reorganize to improve performance coccinelle: use exists to improve efficiency builddeb: Pass the kernel:debarch substvar to dpkg-genchanges Coccinelle: use false positive annotation coccinelle: fix verbose message about .cocci file being run coccinelle: grep Options and Requires fields more precisely Coccinelle: make DEBUG_FILE option more useful coccinelle: api: detect identical chip data arrays coccinelle: Improve setup_timer.cocci matching Coccinelle: setup_timer: improve messages from setup_timer kbuild: rpm-pkg: do not force -jN in submake kbuild: rpm-pkg: keep spec file until make mrproper kbuild: rpm-pkg: fix jobserver unavailable warning kbuild: rpm-pkg: replace $RPM_BUILD_ROOT with %{buildroot} kbuild: rpm-pkg: fix build error when CONFIG_MODULES is disabled kbuild: rpm-pkg: refactor mkspec with here doc kbuild: rpm-pkg: clean up mkspec kbuild: rpm-pkg: install vmlinux.bz2 unconditionally kbuild: rpm-pkg: remove ppc64 specific image handling
2017-11-16coccinelle: orplus: reorganize to improve performanceJulia Lawall1-14/+29
Adding two #define constants is less common than performing & and | operations on them, so put the addition first to reduce the set of cases that have to be considered in detail. At the same time, add & and | patterns for both arguments of +, to account for commutativity and obtain more results. Running time is divided by 3 when applying this to the whole kernel on my laptop with an Intel i5-6200U CPU. Signed-off-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-14Coccinelle: use false positive annotationJulia Lawall1-4/+4
/// is to describe the semantic patch, while //# indicates reasons for false positives. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman3-0/+3
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-12-11Coccinelle: misc: Add support for devm variant in all modesVaishali Thakkar1-3/+12
Add missing support for the devm_request_threaded_irq in the rules of context, report and org modes. Misc: ---- To be consistent with other scripts, change confidence level of the script to 'Moderate'. Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-12-11Coccinelle: misc: Improve the result given by context modeVaishali Thakkar1-1/+2
To eliminate false positives given by the context mode, add necessary arguments for the function request_threaded_irq. Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-12-11Coccinelle: misc: Improve the matching of rulesVaishali Thakkar1-13/+23
Currently because of the left associativity of the operators, pattern IRQF_ONESHOT | flags does not match with the pattern when we have more than one flag after the disjunction. This eventually results in giving false positives by the script. This patch eliminates these FPs by improving the rule. Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-12-11Coccinelle: Add misc/boolconv.cocciAndrew F. Davis1-0/+90
Add a script to check for unneeded conversions to bool. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-10-11Coccinelle: flag conditions with no effectNicholas Mc Guire1-0/+64
Report code constructs where the if and else branch are functionally identical. In cases where this is intended it really should be documented - most reported cases probably are bugs. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-06-20Coccinelle: noderef: Add new rules and correct the old ruleVaishali Thakkar1-1/+17
Add new rules to detect the cases where sizeof is used in function calls as a argument. Also, for the patch mode third rule should behave same as second rule with arguments reversed. So, change that as well. Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-04-20scripts: coccinelle: remove check to move constants to rightWolfram Sang1-171/+0
The header mentions this check depends on personal taste. I agree. Running coccicheck on patches before I apply them, this SmPL produced enough false positives for me that I'd rather see it removed. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-02-18coccinelle: bugon: reduce rule applicabilityJulia Lawall1-1/+1
Rule r is only use in org or report mode, so only execute it in those cases. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-02-18Coccinelle: array_size: reduce rule applicabilityJulia Lawall1-1/+1
Rule r is only use in org or report mode, so only execute it in those cases. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2016-02-18Coccinelle: reduce rule applicabilityJulia Lawall1-1/+1
Rule r is only use in org or report mode, so only execute it in those cases. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2015-10-26coccinelle: Improve checking for missing NULL terminatorsDaniel Granat1-5/+28
Extend checking on tables containing structures which are initialized without specifying member name. Added new tables for checking: i2c_device_id and platform_device_id. Signed-off-by: Daniel Granat <d.granat@samsung.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-10-26coccinelle: misc: remove "complex return code" warningsJohan Hovold1-180/+0
This effectively reverts 932058a5d5f9 ("coccinelle: misc: semantic patch to delete overly complex return code processing"). There can be both symmetry and readability reasons for not wanting to do the final function call as part of the return statement and to maintain a clear separation of success and error paths. Since this is in no way mandated by the coding standard, let's just remove this semantic patch to avoid having "clean up" patches being posted over and over in response to these Coccinelle warnings. Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-10-26coccinelle: misc: move constants to the rightJulia Lawall1-0/+171
Move constants to the right in binary operators. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.com>
2015-06-03coccinelle: simple_return: Add a blank lineFabio Estevam1-1/+1
Insert a blank line in order to improve the readability of the generated patch and also make it consistent with the other .cocci files. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-25coccinelle: irqf_oneshot.cocci: Improve the generated commit logFabio Estevam1-2/+5
Improve the commit log of the generated patch by mentioning the commit log that makes threaded IRQs without a primary handler to be requested with the IRQF_ONESHOT flag. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked- by: Valentin Rothberg <valentinrothberg@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-21scripts/coccinelle/misc/irqf_oneshot.cocci: Fix grammarFabio Estevam1-1/+1
Correct form is 'always requested'. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-21scripts/coccinelle/misc/semicolon.cocci: Use imperative moodFabio Estevam1-1/+1
According to Documentation/SubmittingPatches: "Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour. So do as recommended. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-20coccinelle: ifaddr: Fix the sentenceFabio Estevam1-2/+1
Make the sentence sensible. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-20coccinelle: returnvar: Use imperative moodFabio Estevam1-1/+1
According to Documentation/SubmittingPatches: "Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour." So do as recommended. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-04-15scripts/coccinelle/misc/bugon.cocci: update bug_on conversion warningFabian Frederick1-1/+1
if()/BUG conversion to BUG_ON must be avoided when there's side effect in condition. The reason being BUG_ON won't execute the condition when CONFIG_BUG is not defined. Inspired-by: J. Bruce Fields <bfields@fieldses.org> Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-03-25irqf_oneshot.cocci: add check of devm_request_threaded_irq()Valentin Rothberg1-0/+24
Since commit 1c6c69525b40eb76de8adf039409722015927dc3 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. Until now, this coccinelle script only checked request_threaded_irq(). However, the counterpart devm function (see kernel/irq/devres.c) is also affected by the missing flag which can be detected with this patch. Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-11-24bugon.cocci: fix Options at the macroMauro Carvalho Chehab1-1/+1
The comma after --no-includes makes coccinelle to not run the script: /usr/bin/spatch -D report --very-quiet --no-show-diff --cocci-file ./scripts/coccinelle/misc/bugon.cocci --no-includes, --include-headers --patch . --dir drivers/media/platform/coda/ -I ./arch/x86/include -I arch/x86/include/generated -I include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi -I ./include/uapi -I include/generated/uapi -I ./include/linux/kconfig.h Usage: spatch.opt --sp-file <SP> <infile> [-o <outfile>] [--iso-file <iso>] [options] Options are: --sp-file <file> the semantic patch file -o <file> the output file --in-place do the modification on the file directly --backup-suffix suffix to use when making a backup for inplace ... At least with Fedora 20 coccinelle package: coccinelle-1.0.0-0.rc20.1.fc21.x86_64 Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Tested-by: Wolfram Sang <wsa@the-dreams.de> Fixes: 5be1df66 (Coccinelle: Script to replace if and BUG with BUG_ON) Cc: stable@vger.kernel.org Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-09-26coccinelle: misc: semantic patch to delete overly complex return code processingJulia Lawall1-0/+180
This semantic patch simplifies cases where the effect of the processing of a function call's return code is just to return the result of the function directly. It may also delete a local return flag variable, if this is no longer used. This was proposed by Uwe Kleine-König. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-08-06Coccinelle: Script to replace if and BUG with BUG_ONHimangi Saraogi1-0/+62
This script detects cases where BUG() follows an if condition on an expression and replaces the if condition and BUG() with a BUG_ON having the conditional expression of the if statement as argument. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-08-06Coccinelle: Script to detect incorrect argument to sizeofHimangi Saraogi1-0/+76
This makes an effort to find cases where the argument to sizeof is wrong in memory allocation functions by checking the type of the allocated memory when it is a double pointer and ensuring the sizeof argument takes a pointer to the the memory being allocated. There are false positives in cases the sizeof argument is not used in constructing the return value. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-08-06Coccinelle: Script to use ARRAY_SIZE instead of division of two sizeofsHimangi Saraogi1-0/+87
This script detects cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10coccicheck: Add unneeded return variable testPeter Senna Tschudin1-0/+66
This semantic patch looks for variables that are initialized with a constant, are never updated, and are only used as parameter of return. Return the constant instead of using a variable. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-09coccinelle: Check for missing NULL terminators in of_device_id tablesStephen Boyd1-0/+62
Failure to terminate an of_device_id table can lead to confusing failures depending on where the compiler places the array. Add a check to make sure these tables are terminated. Thanks to Mitchel Humpherys for coming up with the pattern initially. Cc: Mitchel Humpherys <mitchelh@codeaurora.org> Cc: Gilles Muller <Gilles.Muller@lip6.fr> Cc: Nicolas Palix <nicolas.palix@imag.fr> Cc: Rob Herring <robh+dt@kernel.org> Cc: devicetree@vger.kernel.org Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-03-29Coccicheck: Remove memcpy to struct assignment testPeter Senna Tschudin1-103/+0
The Coccinelle script scripts/coccinelle/misc/memcpy-assign.cocci look for opportunities to replace a call to memcpy by a struct assignment. This patch removes memcpy-assign.cocci as it is not clear that this convention has an impact on the generated code. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-08-13coccinelle: replace 0/1 with false/true in functions returning boolRasmus Villemoes1-0/+58
This semantic patch replaces "return {0,1};" with "return {false,true};" in functions returning bool. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-07-03Coccinelle: Update the options used to the new option schemeNicolas Palix8-8/+8
spatch has changed its option scheme. E.g., --no_show_diff is now --no-show-diff This patch updates: - scripts/coccicheck - Semantic patches under scripts/coccinelle/ Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-02-22scripts/coccinelle: find constant additions that could be bit orsJulia Lawall1-0/+55
Semantic patch (http://coccinelle.lip6.fr/) to check for constants that are added but are used elsewhere as bitmasks. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-02-22scripts/coccinelle/misc/memcpy-assign.cocci: Replace memcpy with struct assignmentPeter Senna Tschudin1-0/+103
There are error-prone memcpy() that can be replaced by struct assignment that are type-safe and much easier to read. This semantic patch looks for memcpy() that can be replaced by struct assignment. Inspired by patches sent by Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-01-24scripts/coccinelle/misc/semicolon.cocci: Add unneeded semicolon testPeter Senna Tschudin1-0/+83
This semantic patch looks for semicolons that can be removed without changing the semantics of the code. The confidence is moderate because there are some false positives on cases like: b/drivers/mmc/host/cb710-mmc.c:589 break; case MMC_POWER_UP: default: - /* ignore */; } There are 37 patches accepted reported by this semantic patch and more than 300 fixes to be applied. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-12-09scripts/coccinelle/misc/warn.cocci: use WARNJulia Lawall1-0/+109
Use WARN(1,...) rather than printk followed by WARN(1). Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-07-13scripts/coccinelle: Find threaded IRQs requests which are missing IRQF_ONESHOTLars-Peter Clausen1-0/+65
Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. This semantic patch will help to statically identify (and fix) such cases. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-05-25scripts/coccinelle: sizeof of pointerJulia Lawall1-0/+65
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-05-25scripts/coccinelle: address test is always trueJulia Lawall1-0/+35
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-02-25coccinelle: semantic patch for bool issuesJulia Lawall1-0/+178
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-02-25coccinelle: semantic patch to check for PTR_ERR after reassignmentJulia Lawall1-0/+41
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-01-15scripts/coccinelle: improve the coverage of some semantic patchesJulia Lawall1-4/+4
This patch ensures that all semantic patches in the scripts/coccinelle directory provide the report option. Report messages that include line numbers now have the line number preceded by "line" for easier subsequent processing. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-12-03scripts/coccinelle: update for compatability with Coccinelle 0.2.4Julia Lawall1-3/+3
For doubleinit.cocci, Coccinelle 0.2.4 requires a comma after ... in a field list. Coccinelle also now behaves gracefully when a definition is provided for a virtual that doesn't exist, so there is no need for the semantic patch code to check for this case. Updated the documentation to reflect the fact that the best results will now be obtained with Coccinelle version 0.2.4 or later. Signed-off-by: Julia Lawall <julia@diku.dk>