kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] coccinelle: api: add kzfree script
@ 2020-06-04 15:20 Markus Elfring
  2020-06-04 15:56 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2020-06-04 15:20 UTC (permalink / raw)
  To: Denis Efremov, Gilles Muller, Julia Lawall, Masahiro Yamada,
	Michal Marek, Nicolas Palix, Coccinelle
  Cc: kernel-janitors, linux-kernel

> Check for memset() with 0 followed by kfree().

I suggest to simplify the SmPL code a bit like the following.


> +virtual context
> +virtual org
> +virtual report
> +virtual patch

+virtual context, org, report, patch


…
> +@@
> +
> +(
> +* memset(E, 0, ...);
> +|
> +* memset(E, '\0', ...);
> +)
> +* kfree(E)@p;

+@@
+*memset(E, 0, ...);
+*kfree(E)@p;


How does the SmPL asterisk functionality fit to the operation
modes “org” and “report”?


> +@@
> +
> +(
> +- memset(E, 0, ...);
> +|
> +- memset(E, '\0', ...);
> +)
> +- kfree(E);
> ++ kzfree(E);

+@@
+-memset(E, 0, ...);
+-kfree
++kzfree
+       (E);

I got the impression that the specification of a SmPL disjunction
could be omitted because of the technical detail that the isomorphism
“zero_multiple_format” should handle such an use case already.

Would you like to tolerate any extra source code between these function calls?

Regards,
Markus

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

* Re: [PATCH] coccinelle: api: add kzfree script
  2020-06-04 15:20 [PATCH] coccinelle: api: add kzfree script Markus Elfring
@ 2020-06-04 15:56 ` Julia Lawall
  2020-06-04 16:08   ` Markus Elfring
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2020-06-04 15:56 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, Gilles Muller, kernel-janitors, Nicolas Palix,
	linux-kernel, Coccinelle

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



On Thu, 4 Jun 2020, Markus Elfring wrote:

> > Check for memset() with 0 followed by kfree().
>
> I suggest to simplify the SmPL code a bit like the following.
>
>
> > +virtual context
> > +virtual org
> > +virtual report
> > +virtual patch
>
> +virtual context, org, report, patch

This is pointless.

>
>
> …
> > +@@
> > +
> > +(
> > +* memset(E, 0, ...);
> > +|
> > +* memset(E, '\0', ...);
> > +)
> > +* kfree(E)@p;
>
> +@@
> +*memset(E, 0, ...);
> +*kfree(E)@p;
>
>
> How does the SmPL asterisk functionality fit to the operation
> modes “org” and “report”?

make coccicheck uses the option --no-show-diff for the org and report
modes.

>
> > +@@
> > +
> > +(
> > +- memset(E, 0, ...);
> > +|
> > +- memset(E, '\0', ...);
> > +)
> > +- kfree(E);
> > ++ kzfree(E);
>
> +@@
> +-memset(E, 0, ...);
> +-kfree
> ++kzfree
> +       (E);
>
> I got the impression that the specification of a SmPL disjunction
> could be omitted because of the technical detail that the isomorphism
> “zero_multiple_format” should handle such an use case already.
>
> Would you like to tolerate any extra source code between these function calls?

I already addressed these issues.

julia

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

* Re: coccinelle: api: add kzfree script
  2020-06-04 15:56 ` Julia Lawall
@ 2020-06-04 16:08   ` Markus Elfring
  2020-06-06  6:00     ` Markus Elfring
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2020-06-04 16:08 UTC (permalink / raw)
  To: Julia Lawall, Denis Efremov, Coccinelle
  Cc: Michal Marek, Gilles Muller, Nicolas Palix, kernel-janitors,
	linux-kernel

>>> +virtual context
>>> +virtual org
>>> +virtual report
>>> +virtual patch
>>
>> +virtual context, org, report, patch
>
> This is pointless.

I find the proposed SmPL code variant more succinct.


>> How does the SmPL asterisk functionality fit to the operation
>> modes “org” and “report”?
>
> make coccicheck uses the option --no-show-diff for the org and report modes.

Can it be nicer to avoid the usage of specific functionality
in the SmPL script directly?
Should the corresponding SmPL rule dependencies become clearer?

Regards,
Markus

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

* Re: coccinelle: api: add kzfree script
  2020-06-04 16:08   ` Markus Elfring
@ 2020-06-06  6:00     ` Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-06-06  6:00 UTC (permalink / raw)
  To: Julia Lawall, Denis Efremov, Coccinelle
  Cc: Joe Perches, kernel-janitors, linux-kernel

> Is avoiding transforming the case where E is not verified to be a pointer a concern?

I imagine that answers to this question have got consequences also on
the confidence level for such SmPL scripts.
The desire and requirement to specify data type restrictions (for expressions)
can influence data processing efforts in significant ways.

* If it would be accepted to choose a simpler source code search approach,
  there are corresponding risks to consider.

* If you would like to reduce the general possibility for false positives
  according to advanced software analysis, the amount of data processing
  will increase because information from header files will probably be needed.
  The run time characteristics will become more interesting then.
  Additional program execution parameters will be relevant for this use case.

Regards,
Markus

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

end of thread, other threads:[~2020-06-06  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 15:20 [PATCH] coccinelle: api: add kzfree script Markus Elfring
2020-06-04 15:56 ` Julia Lawall
2020-06-04 16:08   ` Markus Elfring
2020-06-06  6:00     ` Markus Elfring

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).