diff options
author | Julia Lawall | 2009-02-08 22:43:19 +0100 |
---|---|---|
committer | James Bottomley | 2009-02-10 11:15:19 -0500 |
commit | e916141c6889e2a35869d7057ef1cc5e5a2e86eb (patch) | |
tree | 594ed76b74ae67796cbb6d7d43336a98e9ee3fb3 /fs/readdir.c | |
parent | 308cec14e6710b4d5b70e9778ce117be8371735d (diff) |
[SCSI] lpfc: 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,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>
Acked-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'fs/readdir.c')
0 files changed, 0 insertions, 0 deletions