Re: [PATCH] checkpatch: Test for kmalloc/memset(0) pairs

From: Julia Lawall
Date: Sun Mar 20 2011 - 04:03:20 EST


On Sun, 20 Mar 2011, Pekka Enberg wrote:

> Hi,
>
> On Fri, Mar 18, 2011 at 11:32 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >> But if we can teach checkpatch to read the rule files, then maybe that
> >> would be beneficial.
>
> On Sun, Mar 20, 2011 at 5:40 AM, Américo Wang <xiyou.wangcong@xxxxxxxxx> wrote:
> > The problem is Perl doesn't really understand C, while Coccinelle does.
>
> It would be nice if Coccinelle would be even more easy to setup and
> use during development. Like with Dave, Coccinelle has been on my todo
> list forever.

You have to get and set up Coccinelle on your own. However, it is part of
many Linux distributions, including ubuntu.

Afterwards, you can run make coccicheck to apply the semantic patches that
are included in the kernel to the entire kernel. There are some options
to eg restrict the choice of rule, the choice of considered Linux files,
and the format of the output. Where possible we have taken
decisions that are common with what is done elsewhere in the make file.

Documentation is in Documentation/coccinelle.txt

Suggestions for how to make it easier to use or the documentation more
understandable are welcome.

thanks,
julia