<-- Back to schedule

Coccinelle: A program matching and transformation tool

Project: Coccinelle

Coccinelle is a program matching and transformation engine. It provides the Semantic Patch Language for specifying desired matches and transformations in C code. Coccinelle has been used in the past for finding bugs in Linux and performing collateral evolutions. Coccinelle scripts are part of the Linux source distribution and are being used by Linux developers on a regular basis.

In the presentation, Himangi will review the impact of Coccinelle on the Linux kernel. Himangi will briefly introduce the structure of Coccinelle scripts. She will talk about managed interfaces like devm_ functions. Using example code changes, she will explain how coccinelle helps in detecting and transforming cases for possible use of the managed interfaces in place of the unmanaged interfaces. Himangi will discuss about coccinelle patches such as ARRAY_SIZE, BUG_ON, missing iounmap(which leads to memory leaks) etc.

She will elaborate the various uses of Coccinelle like searching for all functions that have a specific return type or probe function definitions of a driver, renaming a function, adding a function argument whose value is somehow context-dependent, and reorganizing a data structure. Himangi will also highlight the capabilities of coccinelle and the limitations of the tool.

The audience is anyone who are involved in Linux development. Coccinelle, though a very powerful tool is fairly new and is known to limited people in the community. Developers who look at Coccinelle patches initially find it new, feel it is very confusing and when unaware of its capabilities may decide to avoid it.

This presentation will give an overview of how coccinelle can be a very useful tool and will give developers as well as maintainers an opportunity to consider using coccinelle after being exposed to its capabilities and limitations. The maintainers may also suggest using coccinelle or add TODOs if they find a use-case that is well suited to be solved by Coccinelle.

Himangi Saraogi

Himangi is a Computer Science student at the International Institute of Information Technology, Hyderabad, India. Himangi had been using the operating system Linux for 4 years and out of curiosity got the Linux repository, built it and set out to read the code. The code-base fascinated her and with the support of the community, she got involved in the development and started sending patches.

Himangi has experience in using tools such as checkpatch, sparse and coccinelle. The accepted patches authored by her can be found here: http://tinyurl.com/k35sqhf. Himangi has been working on the Coccinelle project for the Linux Kernel as part of the Outreach Program for Women. Himangi has written a number of Coccinelle scripts to detect and correct errors/warnings throughout the tree. Also, many patches have been submitted which solve issues using the Coccinelle scripts.