All of lore.kernel.org
 help / color / mirror / Atom feed
* 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; 19+ 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] 19+ messages in thread

end of thread, other threads:[~2020-07-22  6:44 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [Cocci] " Julia Lawall
2020-07-21  9:58   ` Julia Lawall
2020-07-21 11:01   ` [v3 " Markus Elfring
2020-07-21 11:01     ` Markus Elfring
2020-07-22  5:50   ` [PATCH v3 " Markus Elfring
2020-07-22  5:50     ` Markus Elfring
2020-07-22  6:02     ` Julia Lawall
2020-07-22  6:02       ` [Cocci] " Julia Lawall
2020-07-22  6:02       ` Julia Lawall
2020-07-22  6:09       ` [v3 " Markus Elfring
2020-07-22  6:09         ` Markus Elfring
2020-07-22  6:24         ` Julia Lawall
2020-07-22  6:24           ` [Cocci] " Julia Lawall
2020-07-22  6:24           ` Julia Lawall
2020-07-22  6:44           ` Markus Elfring
2020-07-22  6:44             ` Markus Elfring

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.