* [PATCH] coccinelle: api/stream_open: Introduce metavariables for checks
@ 2022-04-04 21:59 Nishanth Menon
2022-04-05 6:17 ` Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Nishanth Menon @ 2022-04-04 21:59 UTC (permalink / raw)
To: Nicolas Palix, Julia Lawall
Cc: linux-kernel, cocci, Kirill Smelkov, Nishanth Menon
Coccinelle spatch version 1.1.1 reports the following:
warning: line 134: should no_llseek be a metavariable?
warning: line 141: should noop_llseek be a metavariable?
warning: line 223: should nonseekable_open be a metavariable?
warning: line 290: should nonseekable_open be a metavariable?
warning: line 338: should nonseekable_open be a metavariable?
So, introduce the metavariable similar to other check instances.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
NOTE: This is currently reported in next-20220404, though I have'nt
bisected for exact fixes tags to be used.
scripts/coccinelle/api/stream_open.cocci | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/coccinelle/api/stream_open.cocci b/scripts/coccinelle/api/stream_open.cocci
index df00d6619b06..d33732f35710 100644
--- a/scripts/coccinelle/api/stream_open.cocci
+++ b/scripts/coccinelle/api/stream_open.cocci
@@ -129,6 +129,7 @@ identifier llseek_f;
@ has_no_llseek @
identifier fops0.fops;
+identifier no_llseek;
@@
struct file_operations fops = {
.llseek = no_llseek,
@@ -136,6 +137,7 @@ identifier fops0.fops;
@ has_noop_llseek @
identifier fops0.fops;
+identifier noop_llseek;
@@
struct file_operations fops = {
.llseek = noop_llseek,
@@ -216,6 +218,7 @@ identifier stream_writer.writestream;
@ report_rw depends on report @
identifier fops_rw.openfunc;
+identifier nonseekable_open;
position p1;
@@
openfunc(...) {
@@ -283,6 +286,7 @@ identifier stream_reader.readstream;
@ report_r depends on report @
identifier fops_r.openfunc;
+identifier nonseekable_open;
position p1;
@@
openfunc(...) {
@@ -331,6 +335,7 @@ identifier stream_writer.writestream;
@ report_w depends on report @
identifier fops_w.openfunc;
+identifier nonseekable_open;
position p1;
@@
openfunc(...) {
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] coccinelle: api/stream_open: Introduce metavariables for checks
2022-04-04 21:59 [PATCH] coccinelle: api/stream_open: Introduce metavariables for checks Nishanth Menon
@ 2022-04-05 6:17 ` Julia Lawall
2022-04-05 12:34 ` Nishanth Menon
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2022-04-05 6:17 UTC (permalink / raw)
To: Nishanth Menon; +Cc: Nicolas Palix, linux-kernel, cocci, Kirill Smelkov
On Mon, 4 Apr 2022, Nishanth Menon wrote:
> Coccinelle spatch version 1.1.1 reports the following:
> warning: line 134: should no_llseek be a metavariable?
> warning: line 141: should noop_llseek be a metavariable?
> warning: line 223: should nonseekable_open be a metavariable?
> warning: line 290: should nonseekable_open be a metavariable?
> warning: line 338: should nonseekable_open be a metavariable?
>
> So, introduce the metavariable similar to other check instances.
This changes the semantic from matching the specific thing to anything.
So are you sure that it is what is wanted? If it should always be the
specific thing, then you can get rid of the warning using eg symbol
no_llseek.
julia
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>
> NOTE: This is currently reported in next-20220404, though I have'nt
> bisected for exact fixes tags to be used.
>
> scripts/coccinelle/api/stream_open.cocci | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/coccinelle/api/stream_open.cocci b/scripts/coccinelle/api/stream_open.cocci
> index df00d6619b06..d33732f35710 100644
> --- a/scripts/coccinelle/api/stream_open.cocci
> +++ b/scripts/coccinelle/api/stream_open.cocci
> @@ -129,6 +129,7 @@ identifier llseek_f;
>
> @ has_no_llseek @
> identifier fops0.fops;
> +identifier no_llseek;
> @@
> struct file_operations fops = {
> .llseek = no_llseek,
> @@ -136,6 +137,7 @@ identifier fops0.fops;
>
> @ has_noop_llseek @
> identifier fops0.fops;
> +identifier noop_llseek;
> @@
> struct file_operations fops = {
> .llseek = noop_llseek,
> @@ -216,6 +218,7 @@ identifier stream_writer.writestream;
>
> @ report_rw depends on report @
> identifier fops_rw.openfunc;
> +identifier nonseekable_open;
> position p1;
> @@
> openfunc(...) {
> @@ -283,6 +286,7 @@ identifier stream_reader.readstream;
>
> @ report_r depends on report @
> identifier fops_r.openfunc;
> +identifier nonseekable_open;
> position p1;
> @@
> openfunc(...) {
> @@ -331,6 +335,7 @@ identifier stream_writer.writestream;
>
> @ report_w depends on report @
> identifier fops_w.openfunc;
> +identifier nonseekable_open;
> position p1;
> @@
> openfunc(...) {
> --
> 2.31.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] coccinelle: api/stream_open: Introduce metavariables for checks
2022-04-05 6:17 ` Julia Lawall
@ 2022-04-05 12:34 ` Nishanth Menon
0 siblings, 0 replies; 3+ messages in thread
From: Nishanth Menon @ 2022-04-05 12:34 UTC (permalink / raw)
To: Julia Lawall; +Cc: Nicolas Palix, linux-kernel, cocci, Kirill Smelkov
On 08:17-20220405, Julia Lawall wrote:
>
>
> On Mon, 4 Apr 2022, Nishanth Menon wrote:
>
> > Coccinelle spatch version 1.1.1 reports the following:
> > warning: line 134: should no_llseek be a metavariable?
> > warning: line 141: should noop_llseek be a metavariable?
> > warning: line 223: should nonseekable_open be a metavariable?
> > warning: line 290: should nonseekable_open be a metavariable?
> > warning: line 338: should nonseekable_open be a metavariable?
> >
> > So, introduce the metavariable similar to other check instances.
>
> This changes the semantic from matching the specific thing to anything.
> So are you sure that it is what is wanted? If it should always be the
> specific thing, then you can get rid of the warning using eg symbol
> no_llseek.
Aaah thank you. Will post a v2 with s/identifier/symbol. I still need to
grok the nuance between the two in [1]. Thanks for clarifying.
[...]
[1] https://coccinelle.gitlabpages.inria.fr/website/docs/main_grammar.html
--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-05 22:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 21:59 [PATCH] coccinelle: api/stream_open: Introduce metavariables for checks Nishanth Menon
2022-04-05 6:17 ` Julia Lawall
2022-04-05 12:34 ` Nishanth Menon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®