Julia Lawall
fd2696f399
Btrfs: 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,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: Chris Mason <chris.mason@oracle.com>
2009-09-29 13:51:04 -04:00
..
2009-08-17 16:42:28 -05:00
2009-07-12 12:22:34 -07:00
2009-06-11 21:36:14 -04:00
2009-08-27 12:22:08 -07:00
2009-06-11 21:36:01 -04:00
2009-08-31 17:44:05 -10:00
2009-06-17 08:46:57 -07:00
2009-07-12 12:22:34 -07:00
2009-09-29 13:51:04 -04:00
2009-06-11 21:36:06 -04:00
2009-08-04 03:53:28 +00:00
2009-05-11 14:13:10 +02:00
2009-04-30 10:48:26 -07:00
2009-06-15 21:30:28 -07:00
2009-06-24 08:15:24 -04:00
2009-07-14 12:28:43 -05:00
2009-07-28 14:26:06 -07:00
2009-06-17 00:36:36 -04:00
2009-07-12 12:22:34 -07:00
2009-09-05 13:41:08 -07:00
2009-08-24 16:48:45 +02:00
2009-07-13 16:39:25 -07:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-05-27 10:20:13 -07:00
2009-07-11 11:22:34 -07:00
2009-08-14 14:04:46 +01:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-06-30 18:56:03 -07:00
2009-07-12 12:22:34 -07:00
2009-08-24 12:53:01 -07:00
2009-07-10 19:18:59 -07:00
2009-07-21 11:54:42 +02:00
2009-07-13 17:55:35 -04:00
2009-09-03 15:01:34 +01:00
2009-07-23 11:08:36 -05:00
2009-07-12 12:22:34 -07:00
2009-06-22 11:34:42 -07:00
2009-06-15 21:44:43 -07:00
2009-08-24 16:28:42 -07:00
2009-07-12 12:22:34 -07:00
2009-08-31 12:03:06 +09:00
2009-06-15 21:44:43 -07:00
2009-08-28 12:51:14 -04:00
2009-06-16 19:47:48 -07:00
2009-09-05 13:38:37 -07:00
2009-06-11 21:36:13 -04:00
2009-07-12 13:02:09 -07:00
2009-08-18 16:31:13 -07:00
2009-06-11 21:36:12 -04:00
2009-07-30 17:31:23 +02:00
2009-07-29 19:10:36 -07:00
2009-07-12 12:22:34 -07:00
2009-05-09 10:49:41 -04:00
2009-06-11 21:36:07 -04:00
2009-07-12 12:22:34 -07:00
2009-07-28 13:45:21 -07:00
2009-06-17 00:36:37 -04:00
2009-07-12 12:22:34 -07:00
2009-07-30 17:28:26 +02:00
2009-06-18 13:03:46 -07:00
2009-09-01 17:00:46 -05:00
2009-06-30 18:55:58 -07:00
2009-06-18 14:46:10 +02:00
2009-06-18 13:03:52 -07:00
2009-07-01 11:14:28 -07:00
2009-08-07 10:39:57 -07:00
2009-07-01 10:56:25 +02:00
2009-07-10 20:31:53 +02:00
2009-07-29 21:07:55 +02:00
2009-08-21 17:40:08 -07:00
2009-07-12 12:22:34 -07:00
2009-08-07 10:39:56 -07:00
2009-09-05 11:30:42 -07:00
2009-06-11 21:36:06 -04:00
2009-05-22 23:22:54 +02:00
2009-06-16 19:47:43 -07:00
2009-06-30 18:55:58 -07:00
2009-06-18 13:03:41 -07:00
2009-09-05 11:30:42 -07:00
2009-07-12 12:22:34 -07:00
2009-06-11 21:36:02 -04:00
2009-04-20 23:02:52 -04:00
2009-06-24 08:15:26 -04:00
2009-08-07 14:38:29 -03:00
2009-06-11 21:36:07 -04:00
2009-06-24 08:15:27 -04:00
2009-07-14 12:34:17 +09:00
2009-08-18 16:31:12 -07:00
2009-04-24 16:36:03 -04:00
2009-05-13 15:13:42 -04:00
2009-09-07 11:54:58 +10:00
2009-08-07 10:39:56 -07:00
2009-06-24 08:15:27 -04:00
2009-07-22 21:14:14 +02:00
2009-05-11 14:13:10 +02:00
2009-08-15 18:40:11 -07:00
2009-06-18 13:03:57 -07:00
2009-05-19 11:37:46 +02:00
2009-04-20 23:02:52 -04:00
2009-06-24 08:15:26 -04:00
2009-07-06 13:57:03 -07:00
2009-06-11 21:36:02 -04:00