1
0
Files
linux/drivers/video
Julia Lawall c0d861afa5 drivers/video/backlight/da903x.c: introduce missing kfree
Error handling code following a kzalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,l;
position p1,p2;
expression *ptr != NULL;
@@

(
if ((x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...)) == NULL) S
|
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
)
<... when != x
     when != if (...) { <+...x...+> }
x->f = E
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Mike Rapoport <mike@compulab.co.il>
Cc: Richard Purdie <rpurdie@linux.intel.com>
Cc: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-19 18:49:59 -08:00
..
2008-07-24 10:47:40 -07:00
2008-10-16 11:21:45 -07:00
2008-03-10 18:01:20 -07:00
2008-04-28 08:58:38 -07:00
2008-07-24 10:47:37 -07:00
2008-07-24 10:47:40 -07:00
2008-07-20 17:24:39 -07:00
2008-07-24 10:47:34 -07:00
2008-11-01 12:40:38 -07:00
2008-05-18 13:28:49 -07:00
2008-11-19 18:49:57 -08:00
2008-07-30 09:41:47 -07:00
2008-04-28 08:58:35 -07:00
2008-07-26 12:00:12 -07:00
2008-06-06 11:29:12 -07:00
2008-04-28 08:58:41 -07:00
2008-10-16 11:21:42 -07:00
2008-07-24 10:47:37 -07:00
2008-07-26 12:00:12 -07:00
2008-10-16 11:21:42 -07:00
2008-07-04 10:40:08 -07:00