Skip to content

Commit

Permalink
Merge tag 'coccinelle-for-5.20' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/jlawall/linux

Pull coccinelle semantic patch updates from Julia Lawall:

 - Update the semantic patches in the kernel that contain a URL for
   Coccinelle with a URL that is currently valid (from myself).

 - Add a semantic patch checking for unnecessary NULL tests on dev_{put,
   hold} functions (from Ziyang Xuan, followed bt a modification from
   myself).

 - Drop a semantic patch that replaces 0/1 by booleans, as this change
   was considered to be not worthwhile by some maintainers (from Steve
   Rostedt).

 - Extend an existing semantic patch with more checks for useless tests
   on variables addresses (from Jérémy Lefaure).

* tag 'coccinelle-for-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux:
  update Coccinelle URL
  coccinelle: free: add version constraint
  scripts/coccinelle/free: add NULL test before dev_{put, hold} functions
  coccinelle: Remove script that checks replacing 0/1 with false/true in functions returning bool
  coccinelle: Extend address test from ifaddr semantic patch to test expressions
  • Loading branch information
torvalds committed Aug 8, 2022
2 parents 4e23eee + f01701c commit cab9de7
Show file tree
Hide file tree
Showing 45 changed files with 99 additions and 105 deletions.
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/alloc/zalloc-simple.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Copyright: (C) 2009-2010 Julia Lawall, Nicolas Palix, DIKU.
// Copyright: (C) 2009-2010 Gilles Muller, INRIA/LiP6.
// Copyright: (C) 2017 Himanshu Jha
// URL: http://coccinelle.lip6.fr/rules/kzalloc.html
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --no-includes --include-headers
//
// Keywords: kmalloc, kzalloc
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/atomic_as_refcounter.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright (c) 2016-2017, Elena Reshetova, Intel Corporation
//
// Confidence: Moderate
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --include-headers --very-quiet

virtual report
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/check_bq27xxx_data.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
///
// Confidence: High
// Copyright: (C) 2017 Julia Lawall, Inria/LIP6,
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Requires: 1.0.7
// Keywords: BQ27XXX_DATA

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/d_find_alias.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Keywords: d_find_alias, dput
//
// Confidence: Moderate
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --include-headers

virtual context
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/err_cast.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright: (C) 2009, 2010 Nicolas Palix, DIKU.
// Copyright: (C) 2009, 2010 Julia Lawall, DIKU.
// Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options:
//
// Keywords: ERR_PTR, PTR_ERR, ERR_CAST
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/kstrdup.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/memdup.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/memdup_user.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/pm_runtime.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Keywords: pm_runtime
// Confidence: Medium
// Copyright (C) 2013 Texas Instruments Incorporated -
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --include-headers

virtual patch
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/api/resource_size.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Copyright: (C) 2009, 2010 Nicolas Palix, DIKU.
// Copyright: (C) 2009, 2010 Julia Lawall, DIKU.
// Copyright: (C) 2009, 2010 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options:
//
// Keywords: resource_size
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/free/clk_put.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Confidence: Moderate
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options:

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/free/devm_free.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// Confidence: Moderate
// Copyright: (C) 2011 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2011 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
55 changes: 55 additions & 0 deletions scripts/coccinelle/free/ifnulldev_put.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: GPL-2.0-only
/// Since commit b37a46683739 ("netdevice: add the case if dev is NULL"),
/// NULL check before dev_{put, hold} functions is not needed.
///
/// Based on ifnullfree.cocci by Fabian Frederick.
///
// Copyright: (C) 2022 Ziyang Xuan.
// Comments: -
// Options: --no-includes --include-headers
// Version min: 5.15

virtual patch
virtual org
virtual report
virtual context

@r2 depends on patch@
expression E;
@@
- if (E != NULL)
(
__dev_put(E);
|
dev_put(E);
|
dev_put_track(E, ...);
|
__dev_hold(E);
|
dev_hold(E);
|
dev_hold_track(E, ...);
)

@r depends on context || report || org @
expression E;
position p;
@@

* if (E != NULL)
* \(__dev_put@p\|dev_put@p\|dev_put_track@p\|__dev_hold@p\|dev_hold@p\|
* dev_hold_track@p\)(E, ...);

@script:python depends on org@
p << r.p;
@@
cocci.print_main("NULL check before dev_{put, hold} functions is not needed", p)
@script:python depends on report@
p << r.p;
@@
msg = "WARNING: NULL check before dev_{put, hold} functions is not needed."
coccilib.report.print_report(p[0], msg)
2 changes: 1 addition & 1 deletion scripts/coccinelle/free/iounmap.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Confidence: Moderate
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options:

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/free/kfree.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/free/kfreeaddr.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
///
// Confidence: High
// Copyright: (C) 2013 Julia Lawall, INRIA/LIP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/free/pci_free_consistent.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
///
// Confidence: Moderate
// Copyright: (C) 2013 Petr Strnad.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Keywords: pci_free_consistent, pci_alloc_consistent
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/iterators/device_node_continue.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
// Confidence: High
// Copyright: (C) 2015 Julia Lawall, Inria.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --no-includes --include-headers
// Requires: 1.0.4
// Keywords: for_each_child_of_node, etc.
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/iterators/for_each_child.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
///
// Confidence: High
// Copyright: (C) 2020 Sumera Priyadarsini
// URL: http://coccinelle.lip6.fr
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --no-includes --include-headers

virtual patch
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/iterators/itnull.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/iterators/list_entry_update.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Copyright: (C) 2010 Nicolas Palix, DIKU.
// Copyright: (C) 2010 Julia Lawall, DIKU.
// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/iterators/use_after_iter.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Confidence: Moderate
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2012 Gilles Muller, INRIA/LIP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/locks/call_kern.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Copyright: (C) 2012 Nicolas Palix.
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/locks/double_lock.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Copyright: (C) 2010 Nicolas Palix, DIKU.
// Copyright: (C) 2010 Julia Lawall, DIKU.
// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/locks/flags.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/locks/mini_lock.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
59 changes: 0 additions & 59 deletions scripts/coccinelle/misc/boolreturn.cocci

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/cstptr.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Confidence: High
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/doubleinit.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Copyright: (C) 2010-2012 Nicolas Palix.
// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments: requires at least Coccinelle 0.2.4, lex or parse error otherwise
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/ifcol.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Copyright: (C) 2010 Nicolas Palix, DIKU.
// Copyright: (C) 2010 Julia Lawall, DIKU.
// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/newline_in_nl_msg.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
///
// Confidence: Very High
// Copyright: (C) 2020 Intel Corporation
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --no-includes --include-headers

virtual context
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/noderef.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Confidence: High
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/misc/orplus.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Confidence: Moderate
// Copyright: (C) 2013 Julia Lawall, INRIA/LIP6.
// Copyright: (C) 2013 Gilles Muller, INRIA/LIP6.
// URL: http://coccinelle.lip6.fr/
// URL: https://coccinelle.gitlabpages.inria.fr/website
// Comments:
// Options: --no-includes --include-headers

Expand Down
Loading

0 comments on commit cab9de7

Please sign in to comment.