Julia Lawall
b2b6080905
USB: ehci-omap.c: introduce missing kfree
Error handling code following a kzalloc should free the allocated data.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
when != if (...) { <+...x...+> }
(
x->f1 = E
|
(x->f1 == NULL || ...)
|
f(...,x->f1,...)
)
...>
(
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-11 11:55:27 -08:00
..
2009-12-11 11:55:26 -08:00
2009-09-23 06:46:30 -07:00
2009-09-23 06:46:29 -07:00
2009-09-23 06:46:29 -07:00
2009-12-11 11:55:19 -08:00
2009-12-11 11:55:13 -08:00
2009-09-23 06:46:29 -07:00
2009-12-11 11:55:18 -08:00
2009-12-11 11:55:27 -08:00
2009-11-30 16:43:16 -08:00
2009-12-11 11:55:19 -08:00
2009-12-11 11:55:18 -08:00
2009-09-23 06:46:20 -07:00
2009-12-11 11:55:13 -08:00
2009-11-30 16:43:16 -08:00
2009-12-04 15:39:55 +01:00
2009-10-09 13:52:07 -07:00
2009-12-11 11:55:20 -08:00
2009-09-23 06:46:29 -07:00
2009-09-23 06:46:29 -07:00
2009-09-23 06:46:29 -07:00
2009-12-11 11:55:18 -08:00
2009-09-23 06:46:30 -07:00
2009-12-11 11:55:15 -08:00
2009-09-23 06:46:29 -07:00
2009-09-23 06:46:34 -07:00
2009-11-17 16:46:33 -08:00
2009-10-20 09:40:47 -07:00
2009-11-17 16:46:33 -08:00
2009-12-11 11:55:14 -08:00
2009-09-24 21:22:33 +01:00
2009-11-17 16:46:33 -08:00
2009-11-17 16:46:33 -08:00
2009-09-23 06:46:32 -07:00
2009-10-11 15:57:57 -07:00
2009-12-11 11:55:22 -08:00
2009-11-28 18:03:14 +01:00
2009-09-23 06:46:16 -07:00
2009-09-15 09:50:49 -07:00
2009-09-23 06:46:30 -07:00
2009-09-23 06:46:17 -07:00
2009-12-11 11:55:17 -08:00
2009-12-11 11:55:26 -08:00
2009-12-11 11:55:14 -08:00
2009-12-11 11:55:23 -08:00
2009-12-11 11:55:23 -08:00