All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Update memdup_user.cocci
@ 2020-07-20 16:22 ` Denis Efremov
  0 siblings, 0 replies; 18+ messages in thread
From: Denis Efremov @ 2020-07-20 16:22 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Denis Efremov, cocci, linux-kernel

Add GFP_USER to the allocation flags and handle vmemdup_user().

Changes in v2:
 - memdup_user/vmemdup_user matching suppressed
 - PoC for selfcheck virtual rule
Changes in v3:
 - add missing '-' for patch rule in kmalloc/kzalloc call args
 - selfcheck rule dropped from patchset

Denis Efremov (3):
  coccinelle: api: extend memdup_user transformation with GFP_USER
  coccinelle: api: extend memdup_user rule with vmemdup_user()
  coccinelle: api: filter out memdup_user definitions

 scripts/coccinelle/api/memdup_user.cocci | 64 ++++++++++++++++++++++--
 1 file changed, 61 insertions(+), 3 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
@ 2020-07-21  9:30 ` Markus Elfring
  0 siblings, 0 replies; 18+ messages in thread
From: Markus Elfring @ 2020-07-21  9:30 UTC (permalink / raw)
  To: Denis Efremov, Coccinelle, Gilles Muller, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: linux-kernel, kernel-janitors

…
> +++ b/scripts/coccinelle/api/memdup_user.cocci
> @@ -39,6 +39,28 @@ …
> +@depends on patch@
> +expression from,to,size;
> +identifier l1,l2;
> +@@
> +
> +-  to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> ++  to = vmemdup_user(from,size);

I propose to combine the desired adjustment with the previous SmPL rule
by using another disjunction.


> +@rv depends on !patch@
> +expression from,to,size;
> +position p;
> +statement S1,S2;
> +@@
> +
> +*  to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\));
> +   if (to==NULL || ...) S1
> +   if (copy_from_user(to, from, size) != 0)
> +   S2

* Can it be helpful to omit the SmPL asterisk functionality from
  the operation modes “org” and “report”?

* Should the operation mode “context” work without an extra position metavariable?

Regards,
Markus

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

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

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 16:22 [PATCH v3 0/3] Update memdup_user.cocci Denis Efremov
2020-07-20 16:22 ` [Cocci] " Denis Efremov
2020-07-20 16:22 ` [PATCH v3 1/3] coccinelle: api: extend memdup_user transformation with GFP_USER Denis Efremov
2020-07-20 16:22   ` [Cocci] " Denis Efremov
2020-07-20 16:22 ` [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user() Denis Efremov
2020-07-20 16:22   ` [Cocci] " Denis Efremov
2020-07-20 16:22 ` [PATCH v3 3/3] coccinelle: api: filter out memdup_user definitions Denis Efremov
2020-07-20 16:22   ` [Cocci] " Denis Efremov
2020-07-24 20:02 ` [PATCH v3 0/3] Update memdup_user.cocci Julia Lawall
2020-07-24 20:02   ` [Cocci] " Julia Lawall
2020-07-21  9:30 [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user() Markus Elfring
2020-07-21  9:30 ` Markus Elfring
2020-07-21  9:58 ` Julia Lawall
2020-07-21  9:58   ` Julia Lawall
2020-07-22  5:50   ` Markus Elfring
2020-07-22  5:50     ` Markus Elfring
2020-07-22  6:02     ` Julia Lawall
2020-07-22  6:02       ` 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.