Julia Lawall 966a5d1b85 drivers/net/wan: 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 S. Miller <davem@davemloft.net>
2009-09-11 12:54:30 -07:00
..
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2009-09-01 01:13:50 -07:00
2008-11-25 18:25:32 -08:00
2009-04-04 16:51:14 -07:00
2009-08-12 23:03:00 -07:00
2009-08-12 22:53:28 -07:00
2009-08-12 23:03:01 -07:00
2009-08-12 23:03:01 -07:00
2009-08-12 23:03:01 -07:00
2008-09-22 19:27:10 -07:00
2009-08-15 18:50:44 -07:00
2009-08-05 12:22:11 -07:00
2009-07-06 18:54:51 -07:00
2008-11-25 18:23:59 -08:00
2009-02-04 16:43:44 -08:00
2009-02-26 21:02:19 -08:00
2008-11-25 18:24:57 -08:00
2009-04-16 02:20:08 -07:00
2009-09-07 01:56:52 -07:00
2009-01-06 10:47:44 -08:00
2009-07-06 13:05:13 -07:00
2009-07-20 08:23:26 -07:00
2008-11-25 18:24:38 -08:00
2009-04-16 02:20:16 -07:00
2009-09-03 20:02:13 -07:00
2009-04-16 02:20:21 -07:00
2009-07-16 09:14:23 -07:00
2008-11-10 15:11:56 -05:00
2009-04-29 17:32:34 -07:00
2009-08-02 12:20:40 -07:00
2009-03-27 00:46:48 -07:00
2008-11-25 18:25:49 -08:00
2008-08-29 02:13:33 -07:00
2008-08-29 02:14:29 -07:00
2008-08-29 02:14:43 -07:00
2009-07-12 14:20:04 -07:00
2009-09-02 00:44:09 -07:00
2008-05-30 22:18:02 -04:00
2009-09-01 17:40:33 -07:00
2009-01-11 00:06:36 -08:00