From: Julia Lawall ju...@diku.dk
Test the just-allocated value for NULL rather than some other value.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression x,y;
statement S;
@@
x = \(kmalloc\|kcalloc\|kzalloc\)(...);
(
if ((x) == NULL) S
From: Julia Lawall ju...@diku.dk
Use kzalloc rather than kcalloc(1,...)
The use of the allocated memory that looks like an array is p-relocs[0],
but this should be the same as p-relocs.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
From: Julia Lawall ju...@diku.dk
Error handling code following a kzalloc should free the allocated data.
Similarly for usb-alloc urb.
The semantic match that finds the first problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@r exists@
local idexpression x;
statement S
From: Julia Lawall ju...@diku.dk
If the NULL test is necessary, then the dereference should be moved below
the NULL test.
In the case of drivers/gpu/drm/i915/i915_drv.c, the variable dev_priv
whose initialization causes the problem is never used in the function, so
it is dropped.
Dropped some
From: Julia Lawall ju...@diku.dk
If the NULL test is necessary, then the dereference should be moved below
the NULL test.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
type T;
expression E;
identifier i,fld;
statement S;
@@
- T i = E
From: Julia Lawall ju...@diku.dk
object_list is checked to be not NULL near the beginning of the function and
is not updated subsequently.
A simplified version of the semantic patch that makes this change is as
follows: (http://www.emn.fr/x-info/coccinelle/)
// smpl
@r exists@
local
OK
julia
On Fri, 19 Dec 2008, Eric Anholt wrote:
On Sat, 2008-12-20 at 08:35 +1000, Dave Airlie wrote:
On Sat, Dec 20, 2008 at 3:10 AM, Julia Lawall ju...@diku.dk wrote:
From: Julia Lawall ju...@diku.dk
If the NULL test is necessary, then the dereference should be moved below
From: Julia Lawall ju...@diku.dk
If the NULL test is necessary, then the dereference should be moved below
the NULL test.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/). The result has been modified to
move the initialization of driver down