linux-sg2042/drivers/scsi/lpfc
Julia Lawall e916141c68 [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>
2009-02-10 11:15:19 -05:00
..
Makefile [SCSI] lpfc: bug fixes 2007-06-17 22:38:11 -05:00
lpfc.h [SCSI] lpfc 8.3.0 : Hook lpfc's debugfs into Kconfig 2008-12-29 11:24:28 -06:00
lpfc_attr.c [SCSI] lpfc : correct printk types on PPC compiles 2008-12-29 11:24:34 -06:00
lpfc_compat.h [PATCH] turn many #if $undefined_string into #ifdef $undefined_string 2005-07-27 16:26:08 -07:00
lpfc_crtn.h [SCSI] lpfc 8.3.0 : Add BlockGuard support (T10-DIF) structs and defs 2008-12-29 11:24:27 -06:00
lpfc_ct.c [SCSI] lpfc 8.3.0 : Fix multiple NPIV issues 2008-12-29 11:24:26 -06:00
lpfc_debugfs.c [SCSI] lpfc 8.3.0 : Hook lpfc's debugfs into Kconfig 2008-12-29 11:24:28 -06:00
lpfc_debugfs.h [SCSI] lpfc 8.3.0 : Hook lpfc's debugfs into Kconfig 2008-12-29 11:24:28 -06:00
lpfc_disc.h [SCSI] lpfc 8.2.8 v2 : Add statistical reporting control and additional fc vendor events 2008-10-13 09:28:57 -04:00
lpfc_els.c [SCSI] lpfc: introduce missing kfree 2009-02-10 11:15:19 -05:00
lpfc_hbadisc.c trivial: fix then -> than typos in comments and documentation 2009-01-06 11:28:06 +01:00
lpfc_hw.h [SCSI] lpfc 8.3.0 : Add BlockGuard support (T10-DIF) structs and defs 2008-12-29 11:24:27 -06:00
lpfc_init.c [SCSI] lpfc: Move a dereference below a NULL test 2009-01-02 10:59:38 -06:00
lpfc_logmsg.h [SCSI] lpfc 8.3.0 : Add BlockGuard support (T10-DIF) structs and defs 2008-12-29 11:24:27 -06:00
lpfc_mbox.c [SCSI] lpfc 8.3.0 : Add BlockGuard support (T10-DIF) code 2008-12-29 11:24:28 -06:00
lpfc_mem.c [SCSI] lpfc 8.2.8 v2 : Add statistical reporting control and additional fc vendor events 2008-10-13 09:28:57 -04:00
lpfc_nl.h [SCSI] lpfc 8.3.0 : Added 3 small features and improve PCI EEH support 2008-12-29 11:24:26 -06:00
lpfc_nportdisc.c [SCSI] lpfc 8.3.0 : Fix several minor issues 2008-12-29 11:24:26 -06:00
lpfc_scsi.c [SCSI] lpfc : correct printk types on PPC compiles 2008-12-29 11:24:34 -06:00
lpfc_scsi.h [SCSI] lpfc 8.3.0 : Add BlockGuard support (T10-DIF) code 2008-12-29 11:24:28 -06:00
lpfc_sli.c trivial: fix then -> than typos in comments and documentation 2009-01-06 11:28:06 +01:00
lpfc_sli.h [SCSI] lpfc 8.2.8 : Add new FCOE hardware support 2008-10-13 09:28:54 -04:00
lpfc_version.h [SCSI] lpfc 8.3.0 : Update driver version to 8.3.0 2008-12-29 11:24:28 -06:00
lpfc_vport.c [SCSI] lpfc 8.3.0 : Fix multiple NPIV issues 2008-12-29 11:24:26 -06:00
lpfc_vport.h [SCSI] lpfc 8.2.8 v2 : Add statistical reporting control and additional fc vendor events 2008-10-13 09:28:57 -04:00