* Re: [PATCH v3 0/3] Update memdup_user.cocci
@ 2020-07-26 16:02 ` Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-26 16:02 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle, Gilles Muller,
Masahiro Yamada, Michal Marek, Nicolas Palix
Cc: linux-kernel, kernel-janitors
…
> > Changes in v3:
> > - add missing '-' for patch rule in kmalloc/kzalloc call args
> > - selfcheck rule dropped from patchset
…
> All three applied. …
Will the software development discussion be continued by patches according to
previously mentioned ideas and remaining open issues?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] Update memdup_user.cocci
@ 2020-07-26 16:02 ` Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-26 16:02 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle, Gilles Muller,
Masahiro Yamada, Michal Marek, Nicolas Palix
Cc: linux-kernel, kernel-janitors
…
> > Changes in v3:
> > - add missing '-' for patch rule in kmalloc/kzalloc call args
> > - selfcheck rule dropped from patchset
…
> All three applied. …
Will the software development discussion be continued by patches according to
previously mentioned ideas and remaining open issues?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] [PATCH] Coccinelle: Reduce duplicate code for patch rules of memdup_user.cocci
2020-07-26 16:02 ` Markus Elfring
(?)
@ 2020-08-09 9:20 ` Markus Elfring
2020-08-09 11:25 ` Julia Lawall
-1 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2020-08-09 9:20 UTC (permalink / raw)
To: Julia Lawall, Denis Efremov, Coccinelle, Gilles Muller,
Masahiro Yamada, Michal Marek, Nicolas Palix
Cc: kernel-janitors, linux-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 9 Aug 2020 11:11:20 +0200
Another patch rule was added. A bit of code was copied from a previous
SmPL rule for this change specification.
* Thus reduce duplicate code by using another SmPL disjunction.
* Increase the precision a bit for desired source code adjustments.
Fixes: 9c568dbd677bcfc975220d3157c89c48669a23e3 ("coccinelle: api: extend memdup_user rule with vmemdup_user()")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/api/memdup_user.cocci | 44 +++++++++---------------
1 file changed, 16 insertions(+), 28 deletions(-)
diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci
index e01e95108405..7cf698b4e925 100644
--- a/scripts/coccinelle/api/memdup_user.cocci
+++ b/scripts/coccinelle/api/memdup_user.cocci
@@ -27,34 +27,22 @@ expression from,to,size;
identifier l1,l2;
position p : script:python() { relevant(p) };
@@
-
-- to = \(kmalloc@p\|kzalloc@p\)
-- (size,\(GFP_KERNEL\|GFP_USER\|
-- \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\));
-+ to = memdup_user(from,size);
- if (
-- to==NULL
-+ IS_ERR(to)
- || ...) {
- <+... when != goto l1;
-- -ENOMEM
-+ PTR_ERR(to)
- ...+>
- }
-- if (copy_from_user(to, from, size) != 0) {
-- <+... when != goto l2;
-- -EFAULT
-- ...+>
-- }
-
-@depends on patch@
-expression from,to,size;
-identifier l1,l2;
-position p : script:python() { relevant(p) };
-@@
-
-- to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
-+ to = vmemdup_user(from,size);
+ to =
+(
+- \(kmalloc@p\|kzalloc@p\)
++ memdup_user
+ (
+- size, \( \(GFP_KERNEL\|GFP_USER\) \| \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN \)
++ from, size
+ )
+|
+- \(kvmalloc@p\|kvzalloc@p\)
++ vmemdup_user
+ (
+- size, \(GFP_KERNEL\|GFP_USER\)
++ from, size
+ )
+);
if (
- to==NULL
+ IS_ERR(to)
--
2.28.0
_______________________________________________
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: Reduce duplicate code for patch rules of memdup_user.cocci
2020-08-09 9:20 ` [Cocci] [PATCH] Coccinelle: Reduce duplicate code for patch rules of memdup_user.cocci Markus Elfring
2020-08-09 11:25 ` Julia Lawall
@ 2020-08-09 11:25 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-08-09 11:25 UTC (permalink / raw)
To: Markus Elfring
Cc: Denis Efremov, Coccinelle, Gilles Muller, Masahiro Yamada,
Michal Marek, Nicolas Palix, linux-kernel, kernel-janitors
On Sun, 9 Aug 2020, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 9 Aug 2020 11:11:20 +0200
>
> Another patch rule was added. A bit of code was copied from a previous
> SmPL rule for this change specification.
>
> * Thus reduce duplicate code by using another SmPL disjunction.
I don't care about this issue.
>
> * Increase the precision a bit for desired source code adjustments.
This gives no information. If you explain the improvement in an
understandable way, I will consider whether it is useful to take the
patch.
julia
> Fixes: 9c568dbd677bcfc975220d3157c89c48669a23e3 ("coccinelle: api: extend memdup_user rule with vmemdup_user()")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/api/memdup_user.cocci | 44 +++++++++---------------
> 1 file changed, 16 insertions(+), 28 deletions(-)
>
> diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci
> index e01e95108405..7cf698b4e925 100644
> --- a/scripts/coccinelle/api/memdup_user.cocci
> +++ b/scripts/coccinelle/api/memdup_user.cocci
> @@ -27,34 +27,22 @@ expression from,to,size;
> identifier l1,l2;
> position p : script:python() { relevant(p) };
> @@
> -
> -- to = \(kmalloc@p\|kzalloc@p\)
> -- (size,\(GFP_KERNEL\|GFP_USER\|
> -- \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\));
> -+ to = memdup_user(from,size);
> - if (
> -- to==NULL
> -+ IS_ERR(to)
> - || ...) {
> - <+... when != goto l1;
> -- -ENOMEM
> -+ PTR_ERR(to)
> - ...+>
> - }
> -- if (copy_from_user(to, from, size) != 0) {
> -- <+... when != goto l2;
> -- -EFAULT
> -- ...+>
> -- }
> -
> -@depends on patch@
> -expression from,to,size;
> -identifier l1,l2;
> -position p : script:python() { relevant(p) };
> -@@
> -
> -- to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> -+ to = vmemdup_user(from,size);
> + to =
> +(
> +- \(kmalloc@p\|kzalloc@p\)
> ++ memdup_user
> + (
> +- size, \( \(GFP_KERNEL\|GFP_USER\) \| \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN \)
> ++ from, size
> + )
> +|
> +- \(kvmalloc@p\|kvzalloc@p\)
> ++ vmemdup_user
> + (
> +- size, \(GFP_KERNEL\|GFP_USER\)
> ++ from, size
> + )
> +);
> if (
> - to==NULL
> + IS_ERR(to)
> --
> 2.28.0
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Coccinelle: Reduce duplicate code for patch rules of memdup_user.cocci
@ 2020-08-09 11:25 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-08-09 11:25 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
On Sun, 9 Aug 2020, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 9 Aug 2020 11:11:20 +0200
>
> Another patch rule was added. A bit of code was copied from a previous
> SmPL rule for this change specification.
>
> * Thus reduce duplicate code by using another SmPL disjunction.
I don't care about this issue.
>
> * Increase the precision a bit for desired source code adjustments.
This gives no information. If you explain the improvement in an
understandable way, I will consider whether it is useful to take the
patch.
julia
> Fixes: 9c568dbd677bcfc975220d3157c89c48669a23e3 ("coccinelle: api: extend memdup_user rule with vmemdup_user()")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/api/memdup_user.cocci | 44 +++++++++---------------
> 1 file changed, 16 insertions(+), 28 deletions(-)
>
> diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci
> index e01e95108405..7cf698b4e925 100644
> --- a/scripts/coccinelle/api/memdup_user.cocci
> +++ b/scripts/coccinelle/api/memdup_user.cocci
> @@ -27,34 +27,22 @@ expression from,to,size;
> identifier l1,l2;
> position p : script:python() { relevant(p) };
> @@
> -
> -- to = \(kmalloc@p\|kzalloc@p\)
> -- (size,\(GFP_KERNEL\|GFP_USER\|
> -- \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\));
> -+ to = memdup_user(from,size);
> - if (
> -- to=NULL
> -+ IS_ERR(to)
> - || ...) {
> - <+... when != goto l1;
> -- -ENOMEM
> -+ PTR_ERR(to)
> - ...+>
> - }
> -- if (copy_from_user(to, from, size) != 0) {
> -- <+... when != goto l2;
> -- -EFAULT
> -- ...+>
> -- }
> -
> -@depends on patch@
> -expression from,to,size;
> -identifier l1,l2;
> -position p : script:python() { relevant(p) };
> -@@
> -
> -- to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> -+ to = vmemdup_user(from,size);
> + to > +(
> +- \(kmalloc@p\|kzalloc@p\)
> ++ memdup_user
> + (
> +- size, \( \(GFP_KERNEL\|GFP_USER\) \| \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN \)
> ++ from, size
> + )
> +|
> +- \(kvmalloc@p\|kvzalloc@p\)
> ++ vmemdup_user
> + (
> +- size, \(GFP_KERNEL\|GFP_USER\)
> ++ from, size
> + )
> +);
> if (
> - to=NULL
> + IS_ERR(to)
> --
> 2.28.0
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Cocci] [PATCH] Coccinelle: Reduce duplicate code for patch rules of memdup_user.cocci
@ 2020-08-09 11:25 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2020-08-09 11:25 UTC (permalink / raw)
To: Markus Elfring
Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
linux-kernel, Coccinelle
On Sun, 9 Aug 2020, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 9 Aug 2020 11:11:20 +0200
>
> Another patch rule was added. A bit of code was copied from a previous
> SmPL rule for this change specification.
>
> * Thus reduce duplicate code by using another SmPL disjunction.
I don't care about this issue.
>
> * Increase the precision a bit for desired source code adjustments.
This gives no information. If you explain the improvement in an
understandable way, I will consider whether it is useful to take the
patch.
julia
> Fixes: 9c568dbd677bcfc975220d3157c89c48669a23e3 ("coccinelle: api: extend memdup_user rule with vmemdup_user()")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/api/memdup_user.cocci | 44 +++++++++---------------
> 1 file changed, 16 insertions(+), 28 deletions(-)
>
> diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci
> index e01e95108405..7cf698b4e925 100644
> --- a/scripts/coccinelle/api/memdup_user.cocci
> +++ b/scripts/coccinelle/api/memdup_user.cocci
> @@ -27,34 +27,22 @@ expression from,to,size;
> identifier l1,l2;
> position p : script:python() { relevant(p) };
> @@
> -
> -- to = \(kmalloc@p\|kzalloc@p\)
> -- (size,\(GFP_KERNEL\|GFP_USER\|
> -- \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\));
> -+ to = memdup_user(from,size);
> - if (
> -- to==NULL
> -+ IS_ERR(to)
> - || ...) {
> - <+... when != goto l1;
> -- -ENOMEM
> -+ PTR_ERR(to)
> - ...+>
> - }
> -- if (copy_from_user(to, from, size) != 0) {
> -- <+... when != goto l2;
> -- -EFAULT
> -- ...+>
> -- }
> -
> -@depends on patch@
> -expression from,to,size;
> -identifier l1,l2;
> -position p : script:python() { relevant(p) };
> -@@
> -
> -- to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> -+ to = vmemdup_user(from,size);
> + to =
> +(
> +- \(kmalloc@p\|kzalloc@p\)
> ++ memdup_user
> + (
> +- size, \( \(GFP_KERNEL\|GFP_USER\) \| \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN \)
> ++ from, size
> + )
> +|
> +- \(kvmalloc@p\|kvzalloc@p\)
> ++ vmemdup_user
> + (
> +- size, \(GFP_KERNEL\|GFP_USER\)
> ++ from, size
> + )
> +);
> if (
> - to==NULL
> + IS_ERR(to)
> --
> 2.28.0
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-10 8:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-26 16:02 [PATCH v3 0/3] Update memdup_user.cocci Markus Elfring
2020-07-26 16:02 ` Markus Elfring
2020-08-09 9:20 ` [Cocci] [PATCH] Coccinelle: Reduce duplicate code for patch rules of memdup_user.cocci Markus Elfring
2020-08-09 11:25 ` Julia Lawall
2020-08-09 11:25 ` [Cocci] " Julia Lawall
2020-08-09 11:25 ` 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.