diff options
author | Julia Lawall <julia@diku.dk> | 2010-08-01 19:23:35 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-08-06 12:06:08 -0500 |
commit | 823d219f23b958292279cfdc8583dc4f1f91c2d5 (patch) | |
tree | 509a25fdb647ff5021b8ecad40d26898c59bee85 /drivers/scsi/lpfc | |
parent | e8ed741fcd521a25f1d983ec81f72ac823d8429a (diff) |
[SCSI] pm8001: 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;
expression E;
identifier f,f1;
position p1,p2;
@@
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
<... when != x
when != if (...) { <+...x...+> }
when != (x) == NULL
when != (x) != NULL
when != (x) == 0
when != (x) != 0
(
x->f1 = E
|
(x->f1 == NULL || ...)
|
f(...,x->f1,...)
)
...>
(
return <+...x...+>;
|
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: jack wang <jack_wang@usish.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc')
0 files changed, 0 insertions, 0 deletions