Re: [PATCH 19/20] drivers/net/ethernet/marvell/skge.c: fix error return code

Julia Lawall
2012-10-05T08:08:47Z

On Fri, 5 Oct 2012, Joe Perches wrote:

> On Fri, 2012-10-05 at 07:22 +0200, Julia Lawall wrote:
>> A tool was used to find a potential problem, and then Peter
>> studied the code to see what fix was appropriate.
>
> Hi Julia.
>
> Was it true that a static analysis tool found the original
> potential issue? If so, what tool was it?

In the very beginning, I think that I found the problem in a patch when
looking at patches that contain oopses.

From that I wrote a Coccinelle rule. As Peter showed, the rule just
produces a list of line numbers. The fix cannot easily be automated,
because there are many cases where 0 is a valid error value. Some
functions, for example, have their error value as a nonpositive integer.

> But wasn't the scripted fix applied to the rest of the tree
> robotically?

No. Peter studied each case and considered what should be done, and then
did that. I guess a potentially bad fix could have been applied
automatically and then cleaned up manually, but considering the number of
cases where the fix would be wrong, that seem like a bad idea. Also one
might want to adapt a bit to local conventions about where the
initialization should be added.

julia