Coccinelle Archive on lore.kernel.org
 help / color / Atom feed
* Re: [Cocci] [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
       [not found] <e3d2ffb9-2a47-3d77-0501-9d48845435bd@web.de>
@ 2020-07-21  9:58 ` Julia Lawall
       [not found]   ` <0b326e2b-723c-3482-c0ef-5d6592a9c6cb@web.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-07-21  9:58 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
	linux-kernel, Coccinelle


[-- Attachment #1: Type: text/plain, Size: 980 bytes --]



On Tue, 21 Jul 2020, Markus Elfring wrote:

> …
> > +++ 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?

This is fine as is in all three aspects.

julia

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
       [not found]   ` <0b326e2b-723c-3482-c0ef-5d6592a9c6cb@web.de>
@ 2020-07-22  6:02     ` Julia Lawall
       [not found]       ` <07a06754-94dd-60b1-1ad1-9e602c86b1f8@web.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-07-22  6:02 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
	linux-kernel, Coccinelle


[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]



On Wed, 22 Jul 2020, Markus Elfring wrote:

> >>> +@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.
>
> How do you think about to check run time characteristics for
> the following SmPL script sketches?
>
> A)
> @R1@
> @@
> // Change something
>
> @R2@
> @@
> // Change another thing
>
>
> B)
> @Replacement_with_disjunction@
> @@
> (
> // R1: Change something
> |
> // R2: Change another thing
> )

Markus, you are welcome to try this since you are concerned about it.
But it doesn't matter.

julia

>
>
> >>> +@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?
> >
> > This is fine as is in all three aspects.
>
> Is every technique from the Coccinelle software required for
> each operation mode in such data processing approaches?
>
> Regards,
> Markus
>

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()
       [not found]       ` <07a06754-94dd-60b1-1ad1-9e602c86b1f8@web.de>
@ 2020-07-22  6:24         ` Julia Lawall
  0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2020-07-22  6:24 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
	linux-kernel, Coccinelle



On Wed, 22 Jul 2020, Markus Elfring wrote:

> > Markus, you are welcome to try this since you are concerned about it.
>
> I dare to point software design variations for some reasons.
>
>
> > But it doesn't matter.
>
> Under which circumstances would you begin to care more for involved differences
> in corresponding run time characteristics?

When the difference is hours vs seconds.  In this case, there are
tradeoffs between the two options, andI don't know which would be faster,
but I think it is extremely unlikely that the difference is noticible.
But if you are concerned about it, you are welcome to try.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <e3d2ffb9-2a47-3d77-0501-9d48845435bd@web.de>
2020-07-21  9:58 ` [Cocci] [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user() Julia Lawall
     [not found]   ` <0b326e2b-723c-3482-c0ef-5d6592a9c6cb@web.de>
2020-07-22  6:02     ` Julia Lawall
     [not found]       ` <07a06754-94dd-60b1-1ad1-9e602c86b1f8@web.de>
2020-07-22  6:24         ` [Cocci] [v3 " Julia Lawall

Coccinelle Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git