[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <e3d2ffb9-2a47-3d77-0501-9d48845435bd@web.de>
Date: Tue, 21 Jul 2020 11:30:08 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Denis Efremov <efremov@...ux.com>,
Coccinelle <cocci@...teme.lip6.fr>,
Gilles Muller <Gilles.Muller@...6.fr>,
Julia Lawall <julia.lawall@...ia.fr>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Nicolas Palix <nicolas.palix@...g.fr>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with
vmemdup_user()
…
> +++ b/scripts/coccinelle/api/memdup_user.cocci
> @@ -39,6 +39,28 @@ …
…
> +@...ends 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
Powered by blists - more mailing lists