Skip to contentSkip to conversation

understanding metavariable

DISCUSSION Deepak R Varma 3 participants 6 messages Oct 28, 2022

lore
Share & tools
lore
#0 lore raw

Hello,
I am seeing a few warnings reported by coccicheck where it is suggested to use a metavariable. See this example warning:

warning: line 223: should nonseekable_open be a metavariable?

I tried to understand about metavariable and how to address this coccicheck warning, but did not fully conclude on my next steps.

Could you provide some details on this concept of metavariables please?

#1 lore raw
Quoted 5 lines · Deepak R Varma

Hello,
I am seeing a few warnings reported by coccicheck where it is suggested to use a metavariable. See this example warning:

warning: line 223: should nonseekable_open be a metavariable?

Can you share full more log along with the command you are trying to run. Also, please let me know the kernel version you are trying this on.

- Saurabh

Quoted 7 lines

I tried to understand about metavariable and how to address this coccicheck warning, but did not fully conclude on my next steps.

Could you provide some details on this concept of metavariables please?

#2 lore raw
Quoted 9 lines · Saurabh Sengar
Quoted 5 lines · Deepak R Varma

Hello,
I am seeing a few warnings reported by coccicheck where it is suggested to use a metavariable. See this example warning:

warning: line 223: should nonseekable_open be a metavariable?

Can you share full more log along with the command you are trying to run. Also, please let me know the kernel version you are trying this on.

Hello Saurabh,
My Kernel version is: 6.1.0-rc1-DVK

I am using following coccicheck command to list the warnings:

drv@ubunlion:~/git/kernels/staging$ make coccicheck M=drivers/staging/ | grep -i warning

A snip of the log is attached with this email for your quick reference. Let me know if you need to know anything further.

Thank you,
./drv

Quoted 11 lines

- Saurabh

Quoted 7 lines

I tried to understand about metavariable and how to address this coccicheck warning, but did not fully conclude on my next steps.

Could you provide some details on this concept of metavariables please?

drv@ubunlion:~/git/kernels/staging$ make coccicheck M=drivers/staging/ -j4
/home/drv/.opam/default/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/stream_open.cocci --patch . --dir drivers/staging -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
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?
10 files match
#3 lore raw
Quoted 8 lines · Deepak R Varma
Quoted 7 lines · Saurabh Sengar
Quoted 5 lines · Deepak R Varma

Hello,
I am seeing a few warnings reported by coccicheck where it is suggested to use a metavariable. See this example warning:

warning: line 223: should nonseekable_open be a metavariable?

Quoted 9 lines
Quoted 2 lines

Can you share full more log along with the command you are trying to run. Also, please let me know the kernel version you are trying this on.

Hello Saurabh,
My Kernel version is: 6.1.0-rc1-DVK

I am using following coccicheck command to list the warnings:

drv@ubunlion:~/git/kernels/staging$ make coccicheck M=drivers/staging/ | grep -i warning

This appear to be a warning in script itself, not the WARNING from the report. I tried applying this patch and it appear to fix the problem.
https://www.spinics.net/lists/kernel/msg4306085.html . Julia can add more about this issue or the patch status.

I can suggest you a different command which will avoid showing you any scripts warning. You can give it a try :
make coccicheck DEBUG_FILE=debug.txt M=drivers/staging/

Make sure you don't have debug.txt in you local folder where you run this cmd.

- Saurabh

Quoted 27 lines

A snip of the log is attached with this email for your quick reference. Let me know if you need to know anything further.

Thank you,
./drv

Quoted 11 lines

- Saurabh

Quoted 7 lines

I tried to understand about metavariable and how to address this coccicheck warning, but did not fully conclude on my next steps.

Could you provide some details on this concept of metavariables please?

drv@ubunlion:~/git/kernels/staging$ make coccicheck M=drivers/staging/ -j4
/home/drv/.opam/default/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/stream_open.cocci --patch . --dir drivers/staging -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
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?
10 files match
#4 lore raw
In reply to Saurabh Singh Sengar
Quoted 9 lines · Saurabh Singh Sengar
Quoted 5 lines · Deepak R Varma

Hello,
I am seeing a few warnings reported by coccicheck where it is suggested to use a metavariable. See this example warning:

warning: line 223: should nonseekable_open be a metavariable?

Can you share full more log along with the command you are trying to run. Also, please let me know the kernel version you are trying this on.

The semantic patch could be improved by adding

symbol nonseekable_open;

in the metavariable list, to make clear that it is intended to match exactly. But it is probably better to focus on finding things to change in the Linux kernel .c files.

julia

Quoted 12 lines

- Saurabh

Quoted 7 lines

I tried to understand about metavariable and how to address this coccicheck warning, but did not fully conclude on my next steps.

Could you provide some details on this concept of metavariables please?

#5 lore raw
Quoted 14 lines · Julia Lawall
Quoted 9 lines · Saurabh Singh Sengar
Quoted 5 lines · Deepak R Varma

Hello,
I am seeing a few warnings reported by coccicheck where it is suggested to use a metavariable. See this example warning:

warning: line 223: should nonseekable_open be a metavariable?

Can you share full more log along with the command you are trying to run. Also, please let me know the kernel version you are trying this on.

Quoted 7 lines

The semantic patch could be improved by adding

symbol nonseekable_open;

in the metavariable list, to make clear that it is intended to match exactly. But it is probably better to focus on finding things to change in the Linux kernel .c files.

Thank you Julia and Saurabh. I was not aware of the source of these warnings. I will continue to focus on looking at items from the Kernel .c files as suggested.

Thank you,
./drv

Quoted 16 lines

julia

Quoted 12 lines

- Saurabh

Quoted 7 lines

I tried to understand about metavariable and how to address this coccicheck warning, but did not fully conclude on my next steps.

Could you provide some details on this concept of metavariables please?