Julia Lawall
00b275dbfc
drivers/mtd/maps: introduce missing kfree
...
Error handling code following a kmalloc 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,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: David Woodhouse <David.Woodhouse@intel.com>
2010-06-03 11:29:25 +01:00
..
2010-05-20 09:45:38 -07:00
2010-05-20 09:27:37 -07:00
2010-05-17 17:44:36 -07:00
2010-05-20 09:03:55 -07:00
2010-05-20 09:20:59 -07:00
2010-05-20 21:04:44 -07:00
2010-05-20 10:33:06 -07:00
2010-05-19 17:10:57 -07:00
2010-05-18 08:49:13 -07:00
2010-05-10 23:08:19 +02:00
2010-05-19 11:36:03 -07:00
2010-05-20 09:20:59 -07:00
2010-05-20 12:00:43 +02:00
2010-05-20 09:20:59 -07:00
2010-05-20 13:21:38 -07:00
2010-05-11 17:38:04 -07:00
2010-05-20 09:41:17 -07:00
2010-05-10 10:23:15 +02:00
2010-05-20 21:04:44 -07:00
2010-05-20 21:26:12 -07:00
2010-05-20 21:04:44 -07:00
2010-05-07 21:10:57 +10:00
2010-05-20 21:26:12 -07:00
2010-05-21 07:19:18 -07:00
2010-05-20 12:00:43 +02:00
2010-05-20 09:20:59 -07:00
2010-05-19 11:37:22 -07:00
2010-06-03 11:29:25 +01:00
2010-05-20 21:26:12 -07:00
2010-05-10 10:23:14 +02:00
2010-05-20 09:20:59 -07:00
2010-05-20 09:09:46 -07:00
2010-05-06 22:04:31 -04:00
2010-05-20 09:20:59 -07:00
2010-05-20 09:20:59 -07:00
2010-05-21 07:19:18 -07:00
2010-05-21 07:19:18 -07:00
2010-05-20 09:09:46 -07:00
2010-05-13 17:43:11 +09:00
2010-05-20 09:20:59 -07:00
2010-05-20 21:04:44 -07:00
2010-05-20 21:26:12 -07:00
2010-05-10 10:23:14 +02:00
2010-05-20 21:26:12 -07:00
2010-05-16 22:26:58 -07:00
2010-05-20 13:34:17 -07:00
2010-05-14 16:59:54 +02:00
2010-05-20 13:21:38 -07:00
2010-05-06 18:49:20 +02:00
2010-05-17 21:37:42 +02:00
2010-05-07 14:01:17 -07:00