linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Denis Efremov <efremov@linux.com>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Julia Lawall <Julia.Lawall@lip6.fr>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Coccinelle <cocci@systeme.lip6.fr>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	Joe Perches <joe@perches.com>
Subject: Re: [PATCH 2/2] Coccinelle: extend memdup_user rule with vmemdup_user()
Date: Sun, 31 May 2020 20:43:44 +0200	[thread overview]
Message-ID: <02c75f13-ec79-f4c0-f28a-8a354ea1f6f0@web.de> (raw)

> Add vmemdup_user() transformations to the memdup_user.cocci rule.
> Commit 50fd2f298bef ("new primitive: vmemdup_user()") introduced
> vmemdup_user(). The function uses kvmalloc with GPF_USER flag.

Such a software evolution is also interesting.


> +@depends on patch@


> +-  to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\));
> ++  to = vmemdup_user(from,size);

How do you think about to achieve the desired data processing by the application
of a SmPL disjunction like the following?

 to =
(
-     \( kmalloc \| kzalloc \) (size, \( GFP_KERNEL \| GFP_USER \))
+     memdup_user(from, size)
|
-     \( kvmalloc \| kvzalloc \) (size, \( GFP_KERNEL \| GFP_USER \))
+     vmemdup_user(from, size)
)
 ;


Unfortunately, the Coccinelle software does not like the following
SmPL code variant so far.

 to =
(
-     \( kmalloc \| kzalloc \)
+     memdup_user
|
-     \( kvmalloc \| kvzalloc \)
+     vmemdup_user
)
                 (
-                 size, \( GFP_KERNEL \| GFP_USER \)
+                 from, size
                 );


Message:
25: no available token to attach to


Regards,
Markus

             reply	other threads:[~2020-05-31 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31 18:43 Markus Elfring [this message]
2020-06-01  5:47 ` [2/2] Coccinelle: memdup_user: Extending data processing for special tokens Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-06-01  6:24 [PATCH 2/2] Coccinelle: extend memdup_user rule with vmemdup_user() Markus Elfring
2020-05-30 20:53 [PATCH 0/2] Update memdup_user.cocci Denis Efremov
2020-05-30 20:53 ` [PATCH 2/2] Coccinelle: extend memdup_user rule with vmemdup_user() Denis Efremov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02c75f13-ec79-f4c0-f28a-8a354ea1f6f0@web.de \
    --to=markus.elfring@web.de \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=efremov@linux.com \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).