linux/drivers/mtd/maps
Julia Lawall 00b275dbfc drivers/mtd/maps: 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 Woodhouse <David.Woodhouse@intel.com>
2010-06-03 11:29:25 +01:00
..
Kconfig pcmciamtd: fixing obvious errors 2010-05-14 03:23:01 +01:00
Makefile Merge with mainline to remove plat-omap/Kconfig conflict 2010-03-01 14:19:05 -08:00
amd76xrom.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
autcpu12-nvram.c
bfin-async-flash.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2010-05-10 14:32:46 +01:00
cdb89712.c
ceiva.c mtd: maps: ceiva: do not return random numbers 2010-02-25 12:50:45 +00:00
cfi_flagadm.c
ck804xrom.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
dbox2-flash.c
dc21285.c Nicolas Pitre has a new email address 2009-09-15 09:37:12 -07:00
dilnetpc.c
dmv182.c
edb7312.c
esb2rom.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
fortunet.c
gpio-addr-flash.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
h720x-flash.c
ichxrom.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
impa7.c
integrator-flash.c mtd: maps: Remove BUS_ID_SIZE from integrator_flash 2009-06-24 16:02:06 +01:00
intel_vr_nor.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
ixp4xx.c drivers/mtd: Use kzalloc 2010-05-13 21:23:06 +01:00
ixp2000.c drivers/mtd: Use kzalloc 2010-05-13 21:23:06 +01:00
l440gx.c
map_funcs.c
mbx860.c
netsc520.c
nettel.c
octagon-5066.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pci.c
pcmciamtd.c Merge git://git.infradead.org/mtd-2.6 2010-05-21 07:25:43 -07:00
physmap.c mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device 2010-04-20 08:53:52 +01:00
physmap_of.c drivers/mtd/maps: introduce missing kfree 2010-06-03 11:29:25 +01:00
pismo.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2010-05-10 14:32:46 +01:00
plat-ram.c Fix spelling of 'platform' in comments and doc 2010-02-05 12:22:34 +01:00
pmcmsp-flash.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pxa2xx-flash.c drivers/mtd: Use kzalloc 2010-05-13 21:23:06 +01:00
rbtx4939-flash.c [MTD] Remove mtd->{suspend,resume} calls from board drivers 2009-05-26 16:45:44 +01:00
redwood.c
rpxlite.c
sa1100-flash.c ARM: Fix warning in sa1100-flash.c 2009-11-16 16:13:35 +00:00
sbc_gxx.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sc520cdp.c
scb2_flash.c
scx200_docflash.c
solutionengine.c
sun_uflash.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tqm8xxl.c
ts5500_flash.c
tsunami_flash.c
uclinux.c mtd/maps: uclinux: fix building when partition support is disabled 2009-09-19 11:44:51 -07:00
vmax301.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
vmu-flash.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
wr_sbc82xx_flash.c