All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions
@ 2020-09-02  4:40 ` Denis Efremov
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Efremov @ 2020-09-02  4:40 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Denis Efremov, cocci, linux-kernel

Extend the list of free functions with kvfree(), kvfree_sensitive(),
vfree().

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 scripts/coccinelle/free/ifnullfree.cocci | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci
index 2045391e36a0..285b92d5c665 100644
--- a/scripts/coccinelle/free/ifnullfree.cocci
+++ b/scripts/coccinelle/free/ifnullfree.cocci
@@ -20,8 +20,14 @@ expression E;
 - if (E != NULL)
 (
   kfree(E);
+|
+  kvfree(E);
 |
   kfree_sensitive(E);
+|
+  kvfree_sensitive(E, ...);
+|
+  vfree(E);
 |
   debugfs_remove(E);
 |
@@ -42,9 +48,10 @@ position p;
 @@
 
 * if (E != NULL)
-*	\(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
+*	\(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
+*         debugfs_remove@p\|debugfs_remove_recursive@p\|
 *         usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
-*         dma_pool_destroy@p\)(E);
+*         dma_pool_destroy@p\)(E, ...);
 
 @script:python depends on org@
 p << r.p;
-- 
2.26.2


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

* [Cocci] [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions
@ 2020-09-02  4:40 ` Denis Efremov
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Efremov @ 2020-09-02  4:40 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci, linux-kernel

Extend the list of free functions with kvfree(), kvfree_sensitive(),
vfree().

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 scripts/coccinelle/free/ifnullfree.cocci | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci
index 2045391e36a0..285b92d5c665 100644
--- a/scripts/coccinelle/free/ifnullfree.cocci
+++ b/scripts/coccinelle/free/ifnullfree.cocci
@@ -20,8 +20,14 @@ expression E;
 - if (E != NULL)
 (
   kfree(E);
+|
+  kvfree(E);
 |
   kfree_sensitive(E);
+|
+  kvfree_sensitive(E, ...);
+|
+  vfree(E);
 |
   debugfs_remove(E);
 |
@@ -42,9 +48,10 @@ position p;
 @@
 
 * if (E != NULL)
-*	\(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
+*	\(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
+*         debugfs_remove@p\|debugfs_remove_recursive@p\|
 *         usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
-*         dma_pool_destroy@p\)(E);
+*         dma_pool_destroy@p\)(E, ...);
 
 @script:python depends on org@
 p << r.p;
-- 
2.26.2

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions
  2020-09-02  4:40 ` [Cocci] " Denis Efremov
@ 2020-09-02  6:51   ` Julia Lawall
  -1 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-09-02  6:51 UTC (permalink / raw)
  To: Denis Efremov; +Cc: cocci, linux-kernel



On Wed, 2 Sep 2020, Denis Efremov wrote:

> Extend the list of free functions with kvfree(), kvfree_sensitive(),
> vfree().
>
> Signed-off-by: Denis Efremov <efremov@linux.com>

Applied, thanks.

julia

> ---
>  scripts/coccinelle/free/ifnullfree.cocci | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci
> index 2045391e36a0..285b92d5c665 100644
> --- a/scripts/coccinelle/free/ifnullfree.cocci
> +++ b/scripts/coccinelle/free/ifnullfree.cocci
> @@ -20,8 +20,14 @@ expression E;
>  - if (E != NULL)
>  (
>    kfree(E);
> +|
> +  kvfree(E);
>  |
>    kfree_sensitive(E);
> +|
> +  kvfree_sensitive(E, ...);
> +|
> +  vfree(E);
>  |
>    debugfs_remove(E);
>  |
> @@ -42,9 +48,10 @@ position p;
>  @@
>
>  * if (E != NULL)
> -*	\(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
> +*	\(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
> +*         debugfs_remove@p\|debugfs_remove_recursive@p\|
>  *         usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
> -*         dma_pool_destroy@p\)(E);
> +*         dma_pool_destroy@p\)(E, ...);
>
>  @script:python depends on org@
>  p << r.p;
> --
> 2.26.2
>
>

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

* Re: [Cocci] [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions
@ 2020-09-02  6:51   ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-09-02  6:51 UTC (permalink / raw)
  To: Denis Efremov; +Cc: cocci, linux-kernel



On Wed, 2 Sep 2020, Denis Efremov wrote:

> Extend the list of free functions with kvfree(), kvfree_sensitive(),
> vfree().
>
> Signed-off-by: Denis Efremov <efremov@linux.com>

Applied, thanks.

julia

> ---
>  scripts/coccinelle/free/ifnullfree.cocci | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/free/ifnullfree.cocci b/scripts/coccinelle/free/ifnullfree.cocci
> index 2045391e36a0..285b92d5c665 100644
> --- a/scripts/coccinelle/free/ifnullfree.cocci
> +++ b/scripts/coccinelle/free/ifnullfree.cocci
> @@ -20,8 +20,14 @@ expression E;
>  - if (E != NULL)
>  (
>    kfree(E);
> +|
> +  kvfree(E);
>  |
>    kfree_sensitive(E);
> +|
> +  kvfree_sensitive(E, ...);
> +|
> +  vfree(E);
>  |
>    debugfs_remove(E);
>  |
> @@ -42,9 +48,10 @@ position p;
>  @@
>
>  * if (E != NULL)
> -*	\(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
> +*	\(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
> +*         debugfs_remove@p\|debugfs_remove_recursive@p\|
>  *         usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
> -*         dma_pool_destroy@p\)(E);
> +*         dma_pool_destroy@p\)(E, ...);
>
>  @script:python depends on org@
>  p << r.p;
> --
> 2.26.2
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions
       [not found] <99e82f65-e02e-988a-4e78-4d438ff8e28e@web.de>
@ 2020-09-02  7:24   ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-09-02  7:24 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Denis Efremov, Coccinelle, linux-kernel, kernel-janitors,
	Gilles Muller, Gustavo A. R. Silva, Julia Lawall, Kees Cook,
	Masahiro Yamada, Michal Marek, Nicolas Palix

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



On Wed, 2 Sep 2020, Markus Elfring wrote:

> …
> > +++ b/scripts/coccinelle/free/ifnullfree.cocci
> > @@ -20,8 +20,14 @@ expression E;
> >  - if (E != NULL)
> >  (
> >    kfree(E);
> > +|
> > +  kvfree(E);
> >  |
> >    kfree_sensitive(E);
> > +|
> > +  kvfree_sensitive(E, ...);
> > +|
> > +  vfree(E);
> >  |
> >    debugfs_remove(E);
> >  |
>
> Would you ever get into the development mood to move the source code search
> specification “(E);” out of the SmPL disjunction (as it happened for the rule “r”)?
>
>
> > @@ -42,9 +48,10 @@ position p;
> >  @@
> >
> >  * if (E != NULL)
> > -*	\(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
> > +*	\(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
> > +*         debugfs_remove@p\|debugfs_remove_recursive@p\|
> >  *         usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
> > -*         dma_pool_destroy@p\)(E);
> > +*         dma_pool_destroy@p\)(E, ...);
> …
>
> How do you think about to attach the position variable to the opening parenthesis
> instead of each function name?
>
> +*         dma_pool_destroy\)(@p E, ...);

While it probably impacts few people, this is a really bad idea for org
mode, because org mode colors the thing that the position variable is
attached to.  Having the ( colored would not be very visible.

But even for report mode, this is probably not a good idea for the rare
case where the function name and the argument list are on different lines.

julia

>
>
> Would the number of function call parameters influence such SmPL code any more?
>
> Regards,
> Markus
>

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

* Re: [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions
@ 2020-09-02  7:24   ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-09-02  7:24 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, Kees Cook, Gilles Muller, Nicolas Palix,
	kernel-janitors, Gustavo A. R. Silva, linux-kernel, Coccinelle

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



On Wed, 2 Sep 2020, Markus Elfring wrote:

> …
> > +++ b/scripts/coccinelle/free/ifnullfree.cocci
> > @@ -20,8 +20,14 @@ expression E;
> >  - if (E != NULL)
> >  (
> >    kfree(E);
> > +|
> > +  kvfree(E);
> >  |
> >    kfree_sensitive(E);
> > +|
> > +  kvfree_sensitive(E, ...);
> > +|
> > +  vfree(E);
> >  |
> >    debugfs_remove(E);
> >  |
>
> Would you ever get into the development mood to move the source code search
> specification “(E);” out of the SmPL disjunction (as it happened for the rule “r”)?
>
>
> > @@ -42,9 +48,10 @@ position p;
> >  @@
> >
> >  * if (E != NULL)
> > -*	\(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
> > +*	\(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
> > +*         debugfs_remove@p\|debugfs_remove_recursive@p\|
> >  *         usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
> > -*         dma_pool_destroy@p\)(E);
> > +*         dma_pool_destroy@p\)(E, ...);
> …
>
> How do you think about to attach the position variable to the opening parenthesis
> instead of each function name?
>
> +*         dma_pool_destroy\)(@p E, ...);

While it probably impacts few people, this is a really bad idea for org
mode, because org mode colors the thing that the position variable is
attached to.  Having the ( colored would not be very visible.

But even for report mode, this is probably not a good idea for the rare
case where the function name and the argument list are on different lines.

julia

>
>
> Would the number of function call parameters influence such SmPL code any more?
>
> Regards,
> Markus
>

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

end of thread, other threads:[~2020-09-02  7:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02  4:40 [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions Denis Efremov
2020-09-02  4:40 ` [Cocci] " Denis Efremov
2020-09-02  6:51 ` Julia Lawall
2020-09-02  6:51   ` [Cocci] " Julia Lawall
     [not found] <99e82f65-e02e-988a-4e78-4d438ff8e28e@web.de>
2020-09-02  7:24 ` Julia Lawall
2020-09-02  7:24   ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.