Skip to contentSkip to conversation

Coccinelle tasks

DISCUSSION Aishwarya Pant 2 participants 6 messages Mar 5, 2017 – Mar 6, 2017

lore
Share & tools
lore
#0 lore raw

Hi

I would like to work on a Coccinelle task, but I'm not sure how to go forward.
- I ran a sudo apt-get install coccinelle
- And then ran spatch --sp-file scripts/coccinelle/misc/bugon.cocci drivers/staging/dgnc/* -D report

The output of all scripts I've run has been something like this-

init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: drivers/staging/dgnc/dgnc_cls.c drivers/staging/dgnc/dgnc_cls.h drivers/staging/dgnc/dgnc_driver.c drivers/staging/dgnc/dgnc_driver.h drivers/staging/dgnc/dgnc_mgmt.c drivers/staging/dgnc/dgnc_mgmt.h drivers/staging/dgnc/dgnc_neo.c drivers/staging/dgnc/dgnc_neo.h drivers/staging/dgnc/dgnc_pci.h drivers/staging/dgnc/dgnc_tty.c drivers/staging/dgnc/dgnc_tty.h drivers/staging/dgnc/dgnc_utils.c drivers/staging/dgnc/dgnc_utils.h drivers/staging/dgnc/digi.h drivers/staging/dgnc/Kconfig drivers/staging/dgnc/Makefile drivers/staging/dgnc/TODO

How can I run coccinelle scripts to detect issues and write some of my own (same as coccinelle tasks?) ?

Thanks

#1 lore raw
Quoted 6 lines · Aishwarya Pant

Hi
I would like to work on a Coccinelle task, but I'm not sure how to go forward.
- I ran a sudo apt-get install coccinelle
- And then ran  spatch --sp-file scripts/coccinelle/misc/bugon.cocci drivers/staging/dgnc/* -D report

Don't use * in a file name when you run Coccinelle. That will cause it to consider all the files at once, which will lead to bad memory usage. What you want is to consider the files one at a time, which is done by just putting the directory name, ie what you have but with no /*

Quoted 13 lines

The output of all scripts I've run has been something like this-

init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: drivers/staging/dgnc/dgnc_cls.c drivers/staging/dgnc/dgnc_cls.h drivers/staging/dgnc/dgnc_driver.c drivers/staging/dgnc/dgnc_driver.h drivers/staging/dgnc/dgnc_mgmt.c drivers/staging/dgnc/dgnc_mgmt.h drivers/staging/dgnc/dgnc_neo.c drivers/staging/dgnc/dgnc_neo.h drivers/staging/dgnc/dgnc_pci.h drivers/staging/dgnc/dgnc_tty.c drivers/staging/dgnc/dgnc_tty.h drivers/staging/dgnc/dgnc_utils.c drivers/staging/dgnc/dgnc_utils.h drivers/staging/dgnc/digi.h drivers/staging/dgnc/Kconfig drivers/staging/dgnc/Makefile drivers/staging/dgnc/TODO

Actually, you can see what I just said in this output. It is considering all of the files at once.

Quoted 2 lines

How can I run coccinelle scripts to detect issues and write some of my own (same as coccinelle tasks?) ?

If the above was the only output, then there was nothing for Coccinelle to do on your code. If Coccinelle finds something to change, it will emit a patch. The patch comes on standard output and the above HANDLING stuff comes out on standard error.

I would suggest to work through the tutorial at the top of the Coccinelle tasks page. I can't get to the kernelnewbies page at the moment, but the link should be there somewhere. Alternatively:

slides: http://coccinelle.lip6.fr/papers/tutorial.pdf
video: https://www.youtube.com/watch?v=buZrNd6XkEw (quite optional)

julia

Quoted 13 lines

Thanks

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/888e8142-ac49-424e-b3ca- ea308f66330a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 41 lines · Julia Lawall
Quoted 6 lines · Aishwarya Pant

Hi
I would like to work on a Coccinelle task, but I'm not sure how to go forward.
- I ran a sudo apt-get install coccinelle
- And then ran �spatch --sp-file scripts/coccinelle/misc/bugon.cocci drivers/staging/dgnc/* -D report

Don't use * in a file name when you run Coccinelle. That will cause it to consider all the files at once, which will lead to bad memory usage. What you want is to consider the files one at a time, which is done by just putting the directory name, ie what you have but with no /*

Quoted 13 lines

The output of all scripts I've run has been something like this-

init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: drivers/staging/dgnc/dgnc_cls.c drivers/staging/dgnc/dgnc_cls.h drivers/staging/dgnc/dgnc_driver.c drivers/staging/dgnc/dgnc_driver.h drivers/staging/dgnc/dgnc_mgmt.c drivers/staging/dgnc/dgnc_mgmt.h drivers/staging/dgnc/dgnc_neo.c drivers/staging/dgnc/dgnc_neo.h drivers/staging/dgnc/dgnc_pci.h drivers/staging/dgnc/dgnc_tty.c drivers/staging/dgnc/dgnc_tty.h drivers/staging/dgnc/dgnc_utils.c drivers/staging/dgnc/dgnc_utils.h drivers/staging/dgnc/digi.h drivers/staging/dgnc/Kconfig drivers/staging/dgnc/Makefile drivers/staging/dgnc/TODO

Actually, you can see what I just said in this output. It is considering all of the files at once.

Quoted 2 lines

How can I run coccinelle scripts to detect issues and write some of my own (same as coccinelle tasks?) ?

If the above was the only output, then there was nothing for Coccinelle to do on your code. If Coccinelle finds something to change, it will emit a patch. The patch comes on standard output and the above HANDLING stuff comes out on standard error.

Quoted 6 lines

I would suggest to work through the tutorial at the top of the Coccinelle tasks page. I can't get to the kernelnewbies page at the moment, but the link should be there somewhere. Alternatively:

slides: http://coccinelle.lip6.fr/papers/tutorial.pdf
video: https://www.youtube.com/watch?v=buZrNd6XkEw (quite optional)

Thanks for the references Julia.

I am now facing some issues running coccicheck. I run the command as:

make coccicheck MODE=report M=drivers/staging/vc04_services/ --debug

After issuing some warnings the process fails with the message:

773 777
coccicheck failed

Quoted 15 lines

julia

Quoted 13 lines

Thanks

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/888e8142-ac49-424e-b3ca- ea308f66330a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 51 lines · Aishwarya Pant
Quoted 41 lines · Julia Lawall
Quoted 6 lines · Aishwarya Pant

Hi
I would like to work on a Coccinelle task, but I'm not sure how to go forward.
- I ran a sudo apt-get install coccinelle
- And then ran  spatch --sp-file scripts/coccinelle/misc/bugon.cocci drivers/staging/dgnc/* -D report

Don't use * in a file name when you run Coccinelle. That will cause it to consider all the files at once, which will lead to bad memory usage. What you want is to consider the files one at a time, which is done by just putting the directory name, ie what you have but with no /*

Quoted 13 lines

The output of all scripts I've run has been something like this-

init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: drivers/staging/dgnc/dgnc_cls.c drivers/staging/dgnc/dgnc_cls.h drivers/staging/dgnc/dgnc_driver.c drivers/staging/dgnc/dgnc_driver.h drivers/staging/dgnc/dgnc_mgmt.c drivers/staging/dgnc/dgnc_mgmt.h drivers/staging/dgnc/dgnc_neo.c drivers/staging/dgnc/dgnc_neo.h drivers/staging/dgnc/dgnc_pci.h drivers/staging/dgnc/dgnc_tty.c drivers/staging/dgnc/dgnc_tty.h drivers/staging/dgnc/dgnc_utils.c drivers/staging/dgnc/dgnc_utils.h drivers/staging/dgnc/digi.h drivers/staging/dgnc/Kconfig drivers/staging/dgnc/Makefile drivers/staging/dgnc/TODO

Actually, you can see what I just said in this output. It is considering all of the files at once.

Quoted 2 lines

How can I run coccinelle scripts to detect issues and write some of my own (same as coccinelle tasks?) ?

If the above was the only output, then there was nothing for Coccinelle to do on your code. If Coccinelle finds something to change, it will emit a patch. The patch comes on standard output and the above HANDLING stuff comes out on standard error.

Quoted 6 lines

I would suggest to work through the tutorial at the top of the Coccinelle tasks page. I can't get to the kernelnewbies page at the moment, but the link should be there somewhere. Alternatively:

slides: http://coccinelle.lip6.fr/papers/tutorial.pdf
video: https://www.youtube.com/watch?v=buZrNd6XkEw (quite optional)

Thanks for the references Julia.

Quoted 8 lines

I am now facing some issues running coccicheck. I run the command as:

make coccicheck MODE=report M=drivers/staging/vc04_services/ --debug

After issuing some warnings the process fails with the message:

773 777
coccicheck failed

I would need to see the entire output.

What version of Coccinelle do you have?

julia

Quoted 25 lines
Quoted 17 lines

julia

Quoted 13 lines

Thanks

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/888e8142-ac49-424e-b3ca- ea308f66330a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170306084029.GA28528%40aishwarya.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw
Quoted 57 lines · Julia Lawall
Quoted 53 lines · Aishwarya Pant
Quoted 41 lines · Julia Lawall
Quoted 6 lines · Aishwarya Pant

Hi
I would like to work on a Coccinelle task, but I'm not sure how to go forward.
- I ran a sudo apt-get install coccinelle
- And then ran �spatch --sp-file scripts/coccinelle/misc/bugon.cocci drivers/staging/dgnc/* -D report

Don't use * in a file name when you run Coccinelle. That will cause it to consider all the files at once, which will lead to bad memory usage. What you want is to consider the files one at a time, which is done by just putting the directory name, ie what you have but with no /*

Quoted 13 lines

The output of all scripts I've run has been something like this-

init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: drivers/staging/dgnc/dgnc_cls.c drivers/staging/dgnc/dgnc_cls.h drivers/staging/dgnc/dgnc_driver.c drivers/staging/dgnc/dgnc_driver.h drivers/staging/dgnc/dgnc_mgmt.c drivers/staging/dgnc/dgnc_mgmt.h drivers/staging/dgnc/dgnc_neo.c drivers/staging/dgnc/dgnc_neo.h drivers/staging/dgnc/dgnc_pci.h drivers/staging/dgnc/dgnc_tty.c drivers/staging/dgnc/dgnc_tty.h drivers/staging/dgnc/dgnc_utils.c drivers/staging/dgnc/dgnc_utils.h drivers/staging/dgnc/digi.h drivers/staging/dgnc/Kconfig drivers/staging/dgnc/Makefile drivers/staging/dgnc/TODO

Actually, you can see what I just said in this output. It is considering all of the files at once.

Quoted 2 lines

How can I run coccinelle scripts to detect issues and write some of my own (same as coccinelle tasks?) ?

If the above was the only output, then there was nothing for Coccinelle to do on your code. If Coccinelle finds something to change, it will emit a patch. The patch comes on standard output and the above HANDLING stuff comes out on standard error.

Quoted 6 lines

I would suggest to work through the tutorial at the top of the Coccinelle tasks page. I can't get to the kernelnewbies page at the moment, but the link should be there somewhere. Alternatively:

slides: http://coccinelle.lip6.fr/papers/tutorial.pdf
video: https://www.youtube.com/watch?v=buZrNd6XkEw (quite optional)

Thanks for the references Julia.

I am now facing some issues running coccicheck. I run the command as:

Quoted 8 lines
Quoted 6 lines

make coccicheck MODE=report M=drivers/staging/vc04_services/ --debug

After issuing some warnings the process fails with the message:

773 777
coccicheck failed

I would need to see the entire output.

Output is:

GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles...
Updating goal targets....
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

drivers/staging/vc04_services//bcm2835-audio/bcm2835.c:224:3-8: No need to set .owner here. The core will do it. drivers/staging/vc04_services//interface/vchiq_arm/vchiq_core.c:912:2-8:
preceding lock on line 856
773 777
coccicheck failed
Successfully remade target file 'coccicheck'.

Quoted 2 lines

What version of Coccinelle do you have?

coccinelle:
Installed: 1.0.4.deb-2

Quoted 28 lines

julia

Quoted 25 lines
Quoted 17 lines

julia

Quoted 13 lines

Thanks

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/888e8142-ac49-424e-b3ca- ea308f66330a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170306084029.GA28528%40aishwarya.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw
Quoted 95 lines · Aishwarya Pant
Quoted 57 lines · Julia Lawall
Quoted 53 lines · Aishwarya Pant
Quoted 41 lines · Julia Lawall
Quoted 6 lines · Aishwarya Pant

Hi
I would like to work on a Coccinelle task, but I'm not sure how to go forward.
- I ran a sudo apt-get install coccinelle
- And then ran  spatch --sp-file scripts/coccinelle/misc/bugon.cocci drivers/staging/dgnc/* -D report

Don't use * in a file name when you run Coccinelle. That will cause it to consider all the files at once, which will lead to bad memory usage. What you want is to consider the files one at a time, which is done by just putting the directory name, ie what you have but with no /*

Quoted 13 lines

The output of all scripts I've run has been something like this-

init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: drivers/staging/dgnc/dgnc_cls.c drivers/staging/dgnc/dgnc_cls.h drivers/staging/dgnc/dgnc_driver.c drivers/staging/dgnc/dgnc_driver.h drivers/staging/dgnc/dgnc_mgmt.c drivers/staging/dgnc/dgnc_mgmt.h drivers/staging/dgnc/dgnc_neo.c drivers/staging/dgnc/dgnc_neo.h drivers/staging/dgnc/dgnc_pci.h drivers/staging/dgnc/dgnc_tty.c drivers/staging/dgnc/dgnc_tty.h drivers/staging/dgnc/dgnc_utils.c drivers/staging/dgnc/dgnc_utils.h drivers/staging/dgnc/digi.h drivers/staging/dgnc/Kconfig drivers/staging/dgnc/Makefile drivers/staging/dgnc/TODO

Actually, you can see what I just said in this output. It is considering all of the files at once.

Quoted 2 lines

How can I run coccinelle scripts to detect issues and write some of my own (same as coccinelle tasks?) ?

If the above was the only output, then there was nothing for Coccinelle to do on your code. If Coccinelle finds something to change, it will emit a patch. The patch comes on standard output and the above HANDLING stuff comes out on standard error.

Quoted 6 lines

I would suggest to work through the tutorial at the top of the Coccinelle tasks page. I can't get to the kernelnewbies page at the moment, but the link should be there somewhere. Alternatively:

slides: http://coccinelle.lip6.fr/papers/tutorial.pdf
video: https://www.youtube.com/watch?v=buZrNd6XkEw (quite optional)

Thanks for the references Julia.

I am now facing some issues running coccicheck. I run the command as:

Quoted 8 lines
Quoted 6 lines

make coccicheck MODE=report M=drivers/staging/vc04_services/ --debug

After issuing some warnings the process fails with the message:

773 777
coccicheck failed

I would need to see the entire output.

Output is:

GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles...
Updating goal targets....
File 'coccicheck' does not exist.
Must remake target 'coccicheck'.

Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

drivers/staging/vc04_services//bcm2835-audio/bcm2835.c:224:3-8: No need to set .owner here. The core will do it. drivers/staging/vc04_services//interface/vchiq_arm/vchiq_core.c:912:2-8:
preceding lock on line 856
773 777
coccicheck failed
Successfully remade target file 'coccicheck'.

Quoted 1 line
Quoted 4 lines
Quoted 1 line

What version of Coccinelle do you have?

coccinelle:
Installed: 1.0.4.deb-2

Perhaps you could try installing the github version. There were some problems related to make coccicheck that were resolved fairly recently.

julia